04-06-2016 08:41 AM
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?
04-06-2016 08:58 AM
Two ways to get help on the dir command:
04-06-2016 09:35 AM
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").
04-06-2016 09:43 AM
@KurtBremser 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.
04-06-2016 11:07 AM
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.
04-06-2016 01:23 PM
04-06-2016 06:02 PM
The creation date will not give you the latest file. For that, you need the modification timestamp.