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
ASKED:
December 1, 2010 8:59 AM
UPDATED:
December 21, 2010 10:47 AM
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
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
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.
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’)
In the same, is there is a way to delete specific files from IFS folder based on date?