Help using Base SAS procedures

Returning Filenames & Creation Date in a directory (i.e unix ls -l)?

Reply
Occasional Contributor
Posts: 15

Returning Filenames & Creation Date in a directory (i.e unix ls -l)?

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

Super User
Posts: 5,430

Re: Returning Filenames & Creation Date in a directory (i.e unix ls -l)?

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
Occasional Contributor
Posts: 15

Re: Returning Filenames & Creation Date in a directory (i.e unix ls -l)?

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

Super User
Super User
Posts: 7,055

Re: Returning Filenames & Creation Date in a directory (i.e unix ls -l)?

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.

Occasional Contributor
Posts: 15

Re: Returning Filenames & Creation Date in a directory (i.e unix ls -l)?

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

Ask a Question
Discussion stats
  • 4 replies
  • 714 views
  • 3 likes
  • 3 in conversation