#!/bin/bash # # Pupose: lists all files that reside in a given folder into a file. # Number of input arguments: 2 # argument 1: path to the folder whose files have to be listed # argument 2: name of the file where the list has to be generated # #echo 'Argument 1 is: '$1 #echo 'Argument 2 is: '$2 # erase the list file if any rm -f $2 # generate empty list file touch $2 # for every file of the folder for file in $1cdsd* do # write file name in ./t echo $file > ./t # concatenate file list and ./t into ./t1 cat $2 ./t > ./t1 # overwrite list file by t1 cat ./t1 > $2 done # erase temporary files and exit #rm -f t t1 exit 0