LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-09-2010, 10:45 PM   #1
pobrika
Member
 
Registered: Jan 2008
Location: Bournemouth, UK
Distribution: Mint, #!, Fedora, Redhat, Centos
Posts: 70

Rep: Reputation: 18
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
 
Old 08-09-2010, 11:45 PM   #2
yooy
Senior Member
 
Registered: Dec 2009
Posts: 1,387

Rep: Reputation: 174Reputation: 174
hm,
you can search for mp3 with find (filetype) and than "cp"
on first search grep directories names and create them on local disk
on second search actualy copy files.
 
Old 08-09-2010, 11:56 PM   #3
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
You can use this script that I posted before to copy files that end in .mp3.
http://www.linuxquestions.org/questi...0/#post3895402
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH Script to clamscan network shares... Devcon Programming 10 12-03-2009 05:55 AM
I want to copy my hard drive to a larger hard drive and boot from the new drive. lpmorgan1 Ubuntu 8 09-07-2009 11:26 PM
Forgot command to copy music to Hard drive? M$ISBS Linux - Software 6 04-02-2007 08:40 AM
Copy Fedora 5 Hard Drive to another Hard Drive Using Knoppix 5.1.1 lud477 Linux - Software 2 03-17-2007 05:06 PM
copy from hard to a network drive, command window milad126 Linux - Networking 1 05-17-2006 02:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration