BookmarkSubscribeRSS Feed
jerry898969
Pyrite | Level 9

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?

7 REPLIES 7
Tim_SAS
Barite | Level 11

Two ways to get help on the dir command:

  1. Start a Windows command window and enter dir /?.
  2. Google "dir command windows".
Kurt_Bremser
Super User

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").

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

ballardw
Super User

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.

jerry898969
Pyrite | Level 9
Thank you everyone.

The date on the sad file will be used to compare to the same set of files in our archive and production data.
We use the creation date to let us compare to make sure we have the latest file and if not we know we have to do a release.
jerry898969
Pyrite | Level 9

Thank you Kurt,

 

That is what I need.  I need the modification timestamp from a directory listing.

 

Thanks

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2726 views
  • 0 likes
  • 5 in conversation