I have a list of directories within a file and I am attempting to copy those directories to a specified destination.
test.lst:
dir1
dir2
dir three
The list is within the same relative path as the directories as well as the destination, as such:
/dirs/dir1
/dirs/dir2
/dirs/dir three
/dirs/test.lst
Command executed in ./dirs:
cat test.lst | xargs -I {} cp -R {} ./_DEST
Expected result:
Directories in list copied from /dirs to /dirs/_DEST
Actual Result:
[.../dirs] # cat test.lst | xargs -I {} cp -R {} ./_DEST
cp: cannot stat `dir1\r': No such file or directory
cp: cannot stat `dir2\r': No such file or directory
cp: cannot stat `dir three\r': No such file or directory
I have tried adding the full path into the list for each directory (i.e '/...dirs/dir1'), but no help.
all dirs have been relaxed to 777 and are owned by same user/group that is executing the command.
dos2unix test.lst
to remove the\r
s.