BookmarkSubscribeRSS Feed
jammy
Calcite | Level 5

Hi,

I'm trying to get all the filenames (.csv) in a directory & want the creation date of the file, like the unix command ls -l.

I can get some details using list but it wont give me the year.

This is what I have done:

filename dir_lst ftp '' cd="&EMFTDIR" list  user=&qemftname host="&host" pass= &qemftpwd;

data files_list;   attrib a b c d e f g h i  length=$30; 

infile dir_lst dlm=' ' firstobs=1; 

input a b c d e f g h i ;

run;

Is there something else I can use to return the filename & creation date?

Thanks

4 REPLIES 4
LinusH
Tourmaline | Level 20

Do you need tio use ftp?

You could use a remote shell/telnet and filename pipe, or pipe to a temporary file.

Data never sleeps
jammy
Calcite | Level 5

i think so, as I'm using EG & need to read a directory not on a SAS server.

Tom
Super User Tom
Super User

The format returned by the LIST command usually depends on the host that you have connected to.

If you use ls -l on Unix then for files created within the last 6 months it does not return the year, instead it uses that space on the line to display the time.

Perhaps your FTP server is working the same way?

You can figure out the year.

jammy
Calcite | Level 5

thanks Tom, that's right - I was wondering why my new files had a time & some had the year (need to brush up on Unix)!

I've just coded round it.

cheers

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 1795 views
  • 3 likes
  • 3 in conversation