I'm currently going through a manual process of encoding a file list from DOS to Unix so that I can move files from x to y. I would like this process automated in one script but I'm a total noob.
This is the pseudo-code:
Convert
list.txt
to unix encoding (:set ff=unix
)Move files from
/folder
that are present inlist.txt
to/folder2
(in other words,/folder
contains a big list, but i only want the files inlist.txt
to be moved)this is how i'm moving the files:
while read line ; do cp /opt/home/first.last/Runs/clientPDFs/${line}.pdf ~/folder2 ; done < ~/list.txt
If possible I would like the script to check for list.txt
first. If there isn't one it should move ALL files.
if list.txt
then while read line ; do cp /opt/home/first.last/Runs/clientPDFs/${line}.pdf ~/folder2 ; done < ~/list.txt
else while read line ; do cp /opt/home/first.last/Runs/clientPDFs/${line}.pdf ~/folder2