klug
Advanced Member level 1
linux copy filelist
Some problem:
I have some dir with files on it. Also I have some file with list of files to copy. How to copy only files from that list?
I have made some bash script:
-------------------------
#!/bin/bash
#
#
SORCEDIR=/home/danny/files/
TARGETDIR=/home/danny/files2/
ALIST=/home/danny/filelist.txt
FILELIST=`cat $ALIST`
for NAME in $FILELIST
do
cp $SORCEDIR$NAME $TARGETDIR
done
------------------------
But this script is not working correctly if file name has space on it (for example "Last Doc.pdf" ) . How to make correct script?
Thanks in advance. klug.
Some problem:
I have some dir with files on it. Also I have some file with list of files to copy. How to copy only files from that list?
I have made some bash script:
-------------------------
#!/bin/bash
#
#
SORCEDIR=/home/danny/files/
TARGETDIR=/home/danny/files2/
ALIST=/home/danny/filelist.txt
FILELIST=`cat $ALIST`
for NAME in $FILELIST
do
cp $SORCEDIR$NAME $TARGETDIR
done
------------------------
But this script is not working correctly if file name has space on it (for example "Last Doc.pdf" ) . How to make correct script?
Thanks in advance. klug.