Hey all, long time without a post!
I think what I'm doing is simple, but I'm apparently looking at it the wrong way and am now here asking for help!
Just a simple BASH for loop to read the file path from a text file (clean.txt) echo the variable for debug purposes, and scp it to a server I have using port 50 for SSH.
I've already formatted the entries in clean.txt to handle spaces correctly, using sed replacement.
Example from the clean.txt file:
Code:
/MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/20\ Auld\ Lang\ Syne.mp3
/MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/14\ Deck\ the\ Stills.mp3
/MP3/NAS000000001/Bob\ Dylan/Single\ songs/House\ Of\ The\ Rising\ Sun.mp3
For loop thats failing:
Code:
IFS=$'\n'; for f in `cat clean.txt`; do echo -e "\n$f"; sleep 1; scp -P 50 "$f" pete@demo.home.com:/MP3/backup/f; done
STDOutput:
Code:
/MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/20\ Auld\ Lang\ Syne.mp3
Warning: Permanently added 'demo.home.com,xx.xxx.59.143' (RSA) to the list of known hosts.
/MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/20\ Auld\ Lang\ Syne.mp3: Invalid argument
/MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/14\ Deck\ the\ Stills.mp3
Warning: Permanently added 'demo.home.com,xx.xxx.59.143' (RSA) to the list of known hosts.
/MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/14\ Deck\ the\ Stills.mp3: Invalid argument
Using a properly placed echo statement, I know what is being passed:
Code:
/MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/20\ Auld\ Lang\ Syne.mp3
scp -P 50 /MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/20\ Auld\ Lang\ Syne.mp3 pete@demo.home.com:/MP3/backup/f
But if I copy that echo statement and run it from the terminal, IT JUST WORKS!
Code:
scp -P 50 /MP3/NAS000000001/Barenaked\ Ladies/Barenaked\ Ladies\ -\ Barenaked\ For\ The\ Holidays/20\ Auld\ Lang\ Syne.mp3 pete@demo.home.com:/MP3/backup/f
Warning: Permanently added 'demo.home.com,xx.xxx.59.143' (RSA) to the list of known hosts.
20 Auld Lang Syne.mp3 2% 128KB 128.0KB/s 00:33 ETA
I don't get it! Anyone have any insight?
Thanks,
Pete