Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Script to list the file names in a directory

$
0
0
Hi all,

I need a shell script to write into a .txt file the no of files in a directory with extension and separated by comma in between. For eg, a directory contains files like
a.csv
b.csv
c.csv
d.csv

Then the output in the output.txt file should be like
a.csv,b.csv,c.csv,d.csv

Shell used : bash
directory should be passed as parameter.

Please provide comments, if possible.

Thanks in advance.

Regards,
Unix User

Viewing all articles
Browse latest Browse all 16232

Trending Articles