150 pts.
 Retrieve the file names in IFS folder to a 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
ASKED: December 1, 2010  8:59 AM
UPDATED: December 21, 2010  10:47 AM

Answer Wiki:
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 :-)
Last Wiki Answer Submitted:  December 1, 2010  3:24 pm  by  DanTheDane   2,540 pts.
All Answer Wiki Contributors:  DanTheDane   2,540 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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,385 pts.

 

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,385 pts.

 

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 pts.

 

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 pts.

 

In the same, is there is a way to delete specific files from IFS folder based on date?

 150 pts.