Retrieve the file names in IFS folder to a physical file

150 pts.
Tags:
IFS
IFS Directory
IFS Folder
iseries v5r4
Physical File
I got one scenario, in that I need to retrieve the file names including the Dates from IFS folder to a Physical File. From that PF, I need to delete the files older than 15 days. Is there any way to do that?

Thanks

Saravanan



Software/Hardware used:
V5R4M0

Answer Wiki

Thanks. We'll let you know when a new response is added.

Maybe this CL-code may help you:
<pre>
CD xxxx
CRTPF QRPLOBJ/IFSDIR rcdlen(128)
STRQSH CMD(‘ls -lT *.* > /qsys.lib/QRPLOBJ.lib/ifsdir.file/ifsdir.mbr’)
</pre>

The code will create the file you want.
If the essense of your question is that you simply want to delete files older than 15 ys, this url may help:
<pre>
CD /xxxxxxx
STRQSH CMD(‘find . -type f -mtime +110 | xargs rm ‘)
</pre>

Happy coding :-)

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • WilsonAlano
    Hi, You can use QSHELL to do that. Try this in a QSHELL session (STRQSH) find /yourpath -ctime +15 -exec rm {} ; In this example, 15 is the number of days to stay in disk. So any file on /youpath created more than 15 days ago will be removed. Regards, Wilson
    2,600 pointsBadges:
    report
  • WilsonAlano
    If you NEED the IFS list in a file you can use the RTVDIRINF command. Read help about it to know how it works. Wilson
    2,600 pointsBadges:
    report
  • Dsaran2007
    [...] Retrieve the file names in IFS folder to a physical file [...]
    0 pointsBadges:
    report
  • AndyMM
    In CL, use the DSPFLR FLR(FolderName) TYPE(*DOC) OUTPUT(*OUTFILE) OUTFILE(FileName) command to list the files in the IFS folder, The date field LASTRV in that file is 8A in dd/mm/yy format so, when reading through the file (RCVF) in a read loop, you'll need to re-format that field for comparison to a previously-declared date field (15 days ago). If the document in the record is older than your 15 days, use the DLTDLO DLO(FileId_DOCNAM) FLR(FolderName) to delete the document. To declare the outfile in the first place, it might have been better to run the DSPFLR command from a command line beforehand, so that it exists already, making sure that you have *REPLACE in the OUTMBR parameter of the DSPFLR command in the CL program.
    135 pointsBadges:
    report
  • Stone17
    We have a scheduled job to age our IFS files reading a text file with entries like the following. find /ifsdirname/backup -mtime +14 -type f -exec rm {} ; Enter as many entries for you specfic needs Run the following command in job scheduler. Command : QSH CMD'qsys.lib/qgpl.lib/qtxtsrc.file/ifsgedir.mbr')
    10 pointsBadges:
    report
  • Dsaran2007
    In the same, is there is a way to delete specific files from IFS folder based on date?
    150 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following