moving the files in a.txt files to a different directory

HI All,

I am coding a shell script which will pick all the .csv files in a particular directoryand write it in to a .txt file, this .txt file i will use as a source in datastage for processing.

now after the processing is done I have to move and archive all the files in the .txt file to a different folder(say from folder a to folder b).

I am stuck at moving the files which are in the .txt to a different directory, can any one please give me a idea how can I pass the .txt to the shell script so thatit will moves the files which are in .txt.

Please give me some hint.

Thanks.

Hi, do You have one file name per line in the .txt file and no other text in it?
Something like this would perhaps help, assuming your text file is called 1.txt:

while read filename; do
mv "filename" /target/directory
done < 1.txt

At least something to start with :wink:

Best regards,
Lakris

Or

(IFS="
";mv $(cat infile.txt) newdir)

Or maybe with:

xargs < 1.txt -i mv {} newdir

Or maybe like:

(or pipe to csh or whatever shell you want I think).

Thanks for the replies.I am able to move the files which are .txt to differnt dir.

Thanks a lot :slight_smile: