Hello,
I'm trying to get the create and modified dates from a directory listing using filename and pipe.
filename dump pipe "dir ""&&folder&i..\&&filename&i..*.*"" /b " ;
This is the line that I'm doing to pull all the files that start with a specific file name. This returnes all the file names, but no other information. I know it has something to do with "/b" but I'm unable to find a good descripiton of the different modifiers.
I'm guessing it will add the dates along with the name in one character field, correct?
Two ways to get help on the dir command:
Be aware that the "file creation timestamp" in Windows may be complete bogus, depending on your point of view.
Create a file called xxx.txt today.
One month from now, once again create a file called xxx.txt in the same directory (don't delete the original file before that).
Look at the creation timestamp (dir /tc) and be surprised ("File system tunneling").
@Kurt_Bremser has really pulled the main issue here. Don't rely on Windows dates/times for anything, there are numerous ways to fiddle those. Why do you need this information? If it is for audit purpose, then you would need to get your version control system date/times or other locked down system dates/times that you can't tamper with. Otherwise the process is meaningless.
If its just to find a specific set of files, then there is probably betters was of organising it to find this information.
/b = bare format by the way.
In addition to all the good comments above, you could investigate the SAS external file functions Dopen DNUM Dread FOPTNUM FOPTNAME FINFO.
These functions are quite as system dependent as the DIR pipe. Not to mention that Microsoft changes options on things like the DIR command with different versions.
The creation date will not give you the latest file. For that, you need the modification timestamp.
Thank you Kurt,
That is what I need. I need the modification timestamp from a directory listing.
Thanks
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: