Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    Deleting a file from a folder according to a pattern.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Deleting a file from a folder according to a pattern.
 Login/Join
 
Member
posted
Hi,

I have a folder A which has files like below

File1.txt
File1z.txt
File2z.txt
File3z.txt

How do I delete the files which has a pattern which ends with z.txt and leaving other files as it is.

I tried using the File object with a pattern *z.txt ..
It didn't work..
Is there any other way to acheive this.

Thanks


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Report This Post
Expert
posted Hide Post
Can you post the actual code you used, also where are the files, and what happened when you used the code, did it delete all the files, or none, or some ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Hi Waz,



I have the above mentioned files in the path that i have used in the properties and I just built a pflow which includes this FILE(FileOperations)object and ran in the designer,
It runs successfully,but it didn't delete the files.

Thanks


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Report This Post
Expert
posted Hide Post
Don't know if I can help much, not an iWay person.

Does the documentation say that wildcards are supported ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Hi Gopal,
I suspect that File (from) doesn't accept wild cards. I'm not certain, and can't find anything in the doco.

Have you tried the XDRunCmdAgent? You can issue any command line command from a service object using this. Search info centre for 'run command agent' for details.

Regards,
Ade


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
 
Posts: 59 | Location: Birmingham, Blighty | Registered: October 30, 2007Report This Post
Gold member
posted Hide Post
I should probably say, you can issue a command to the server command line with this agent, so you could issue:

del D:\XX_Gopal\GK\FilesDelete\*z.txt

and interrogate the return codes passed back from the agent afterwards...


Ade.


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
 
Posts: 59 | Location: Birmingham, Blighty | Registered: October 30, 2007Report This Post
Member
posted Hide Post
Thanks for the reply AdeH,

But when I execute a simple p-flow with the service XDRunCmdAgent and with the command mentioned by you
del D:\XX_Gopal\GK\FilesDelete\*z.txt,

P-flow fails to execute with the error,
error : Detected problem in agent execute: java.io.IOException: CreateProcess: del D:\XX_Gopal\GK\FilesDelete\*z.txt error=2


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Report This Post
Gold member
posted Hide Post
Hi Gopal,
This works fine for me if I use an SREG to hold the command I'm issuing... set an SREG to have the value:
del D:\XX_Gopal\GK\FilesDelete\*z.txt

Then reference that SREG in your XDRunCmdAgent property runcmd.cmd.label. I left all other properties of the agent as default - platform, false, false, 0, false, false.

Give that a try.
AdeH


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
 
Posts: 59 | Location: Birmingham, Blighty | Registered: October 30, 2007Report This Post
Member
posted Hide Post
Had your issue been solved Gopal?Just let me know..
 
Posts: 1 | Location: Pacific Crt Kelowna, BC | Registered: September 26, 2011Report This Post
Member
posted Hide Post
Hi Adeh,

Thanks for your time.

Even I tried giving the exact file path and this also giving me the same error.

del D:\XX_Gopal\GK\FilesDelete\File3.txt

Service object :-- run variable holds the value del D:\XX_Gopal\GK\FilesDelete\File3.txt.

RunCmdAgent object uses this SREG(run)in runcmd.cmd.label property and all others being default.

This is what the error that I am getting,

error status="1">
   <msg>Exception returned from OS</msg>
   <exception type="java.io.IOException">
      <emsg>Cannot run program "del": CreateProcess error=2, The system cannot find the file specified</emsg>


P-flow is very simple,

I really dont know what is causing this error,is that to do with the access???
or because I am running the p-flow directly from the designer??

As of now I am executing a script directly from a command prompt,as it accepts the wild cards and have made this as a scheduled task.


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Report This Post
Platinum Member
posted Hide Post
Something like this might do the trick:
 
-SET &APP = 'baseapp';
 APP FI DELPROC DISK delproc.fex
 APP QUERY &APP HOLD
 TABLE FILE FOCAPPQ 
 PRINT COMPUTE APPDEL/A200 = 'APP DELETEFILE &APP "' | GETTOK(FILENAME,70,1,'.',70,'A70') || '" TXT';
 WHERE FILENAME LIKE '%z.txt' 
 ON TABLE SET HOLDLIST PRINTONLY
 ON TABLE HOLD AS DELPROC FORMAT ALPHA 
 END 
-RUN 
-IF &RECORDS EQ 0 THEN GOTO DONE;
 EX DELPROC
-DONE
 

Change the &APP to the one of your choice.
This is not OS specific and avoids explicit looping commands such as -REPEAT.
Use the WHERE statement to select files for deletion.
You can comment out the ON TABLE HOLD line to see the code being generated.
Handle with care, you wouldn't want to accidentally wipe out a bunch of files.


WebFOCUS 8.2.06
 
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010Report This Post
Member
posted Hide Post
Try D:\\XX_Gopal\\GK\\FilesDelete\\File3.txt.


iWay Service Manager (6.0.1 - patch.62627)
DMC Version 7 Release 7
 
Posts: 12 | Registered: January 24, 2011Report This Post
Gold member
posted Hide Post
I would raise a case with IBs info response about your initial issue with the file object.

AdeH


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
 
Posts: 59 | Location: Birmingham, Blighty | Registered: October 30, 2007Report This Post
Gold member
posted Hide Post
Hi,
Silly question really, but can you issue the command 'del D:\XX_Gopal\GK\FilesDelete\File3.txt' from your command line? I'm thinking either you're not on windows, so DEL isn't the correct keyword for deleting files, or maybe it's a permissions problem?
Can you try running your pflow from a listener/channel in iSM? I've seen plenty of differences between that and test running in designer in the past...

Ade


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
 
Posts: 59 | Location: Birmingham, Blighty | Registered: October 30, 2007Report This Post
Member
posted Hide Post
Hi Adeh,

Yes, I can able to delete from the command line.

As the designer didn't work out,I am executing a script directly from a command prompt,as it accepts the wild cards and have made this as a scheduled task,that checks and deletes the files everyday.

Previously I was running the p-flow directly from designer,But I have to try the channel option.


iWay ISM 5.5/iWay ISM 6.0 on Windows.
 
Posts: 20 | Registered: April 11, 2011Report This Post
Expert
posted Hide Post
Could this be a security issue ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    Deleting a file from a folder according to a pattern.

Copyright © 1996-2020 Information Builders