04-30-2018 07:58 AM
I want to delete the folders (want to keep 5 days folders only).
my code is creating folders every day yymmdd10. format.
but I want to keep only 5 days folders only.
my folders are like this
04-30-2018 08:19 AM
Something like (and you don't mention which os you use so windows assumed):
Filename filelist pipe "dir /b /s c:\temp\*.sas"; Data _null_; Infile filelist truncover; Input filename $100.; if _n_>5 then call execute(cats('%sysexec(del c:/temp/"',filename,'");')); Run;
You can change the if as you like, maybe input as date and check if date is today()-5 or less.
04-30-2018 08:39 AM
04-30-2018 08:54 AM
I am not opening zip files.
Just change the filename to point to your area, i.e replace c:/temp with where your folders are located:
Filename filelist pipe "dir /b /s /ad c:\temp\";
Note I added /ad to restrict list to directories only.
04-30-2018 09:19 AM
I think,I have an issue with my sas shortcut.
NOTE: The infile FILELIST is:Unnamed Pipe Access Device,PROCESS=dir /b /s C:\test\.
04-30-2018 09:29 AM
I don't know what "I think,I have an issue with my sas shortcut." means? The note seems correct, assuming all your folders are in c:/test. Note your missing the /ad, which only gets directories.
04-30-2018 11:14 AM
You need XCMD enabled to use PIPE commands or to use system commands.
If that errors out, you'll need a different method, most likely using FDELETE instead. It's still possible, just a different approach required.