Hi,
Could someone help me to get the file names in a directory from Unix environment
Below code is for Windows,
filename indata pipe 'dir "/home/euqyi/shared_folder/user_data/Vishal/pah/Inflated/Data Month March 2019/pah_dx_??????.txt" /b';
Will it work for Unix environment ?
I am using the below piece of code
filename indata pipe 'dir "/home/eupoq/shared_folder/user_data/Richard/pah/Inflated/Data Month March 2019/pah_dx_??????.txt" /b';
data file_list;
length fname $50;
infile indata truncover; /* infile statement for file names */
input fname $50.; /* read the file names from the directory */
call symput ('num_files',_n_); /* store the record number in a macro variable */
run;
And getting below error in Output data
fname
1 dir: cannot access /home/euqyi/shared_folder/user_
2 dir: cannot access /b: No such file or directory
Please help me on this.
Thanks,
Vishal
What is the purpose of /b in Windows?
@karthic2612 I think for Unix the dir counterpart is ls. May be you can try.
What is the purpose of /b in Windows?
we can use the DOS command "dir" with the /B option to list only the file names.
Thanks,
Vishal
Then just replacing dir with ls and not using /b is my suggestion. May be this will work.
Thanks...
It worked for me. By replacing ls with dir and /b option.
All the best
A simple
ls
is the UNIX equivalent of dir with the /b option.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.