Bash script to copy all music to new hard drive from multiple network shares.
Hi guys,
I need a script to copy music from a network drive to my local disk.
I require the script to auto mount the remote server, then to create the directory path to the mp3's
I have a list of all teh songs in the following format, note some have spaces.
\\7800SPARE4\Users\Public\Music\Sample Music\Kalimba.mp3 \\7800SPARE4\Users\Public\Music\Sample Music\Maid with the Flaxen Hair.mp3 \\7800SPARE5\Users\Public\Music\Sample Song \Sleep Away.mp3
I can use the following to mount the directory:
mount -t cifs //7800SPARE4/Users /dest-o username=user,password=pass
I'm thinking the best way would be to get the share name 7800SPARE and the grep for all these in the list, then mount it and do a while read LINE
However I would need to creat the folders, I am unsure on how to do this. I think I would need to sed the backslashes to forward ones and then use rsync? Then unmount and move on to the next ones, if I can't mount the share It would be nice to log it and skip it.
If anyone has a script for this it would be great.
Thanks
|