Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
Reply to this topicStart new topic
> Script to copy files, Rsync?, Help to make a working script for copy files
post Apr 28 2014, 04:05 PM
Post #1

Whats this Lie-nix Thing?

Group: Members
Posts: 1
Joined: 28-April 14
Member No.: 18,707


I need some help to make a script to copy files from a local folder to a network drive.
First of all I want to tell you this is my first time in linux environment, so be kind and clear. tongue.gif

My setup: Raspberry Pi with Raspbian wheezy, with a local connected USB-drive and a network drive. I have mounted both drives so they are available from the pi.

/home/pi DOWNLOAD > completed (local USB-drive)
MOVIES > HD (Network Drive part.1)
TV > SERIES > X (Network Drive part.2)
Y (Network Drive part.2)
Z (Network Drive part.2)

I want a script that copy all specific files (.avi etc) from /home/pi/DOWNLOAD/completed which dosen't already exist on the destination and put those in the predetermined folder.

etc. /home/pi/DOWNLOAD/completed/xxxxxYxx.avi goes to /home/pi/TV/SERIES/Y
/home/pi/DOWNLOAD/completed/xxxxxXxx.avi goes to /home/pi/TV/SERIES/X
/home/pi/DOWNLOAD/completed/xxxxxZxx.avi goes to /home/pi/TV/SERIES/Z
/home/pi/DOWNLOAD/completed/xxxxxxxx.avi goes to /home/pi/MOVIES/HD

I've struggled with rsync for a few days now and I think I got a good structure but somehow nothing happens when I run the .sh-script and when I try to run the rsync command manually it just say it is a (dry-run) even though I don't have the parameter -n in the command.

here is my "script" ^^'


#the header for log-file
echo '-----------------------------------------------------------------------------' >> $LOG_FILE
date >> $LOG_FILE

#rsync commands
rsync -av --include='*/' --include='*X*.avi' --exclude '*' -prune-emty-dirs /home/pi/DOWNLOAD/completed /home/pi/TV/SERIES/X &>> $LOG_FILE
rsync -av --include='*/' --include='*Y*.avi' --exclude '*' -prune-emty-dirs /home/pi/DOWNLOAD/completed /home/pi/TV/SERIES/Y &>> $LOG_FILE
rsync -av --include='*/' --include='*Z*.avi' --exclude '*' -prune-emty-dirs /home/pi/DOWNLOAD/completed /home/pi/TV/SERIES/Z &>> $LOG_FILE
rsync -av --include='*/' --include='*.avi' --exclude '*' --exclude='*X*.avi' --exclude='*Y*.avi' --exclude='*Z*.avi' -prune-emty-dirs /home/pi/DOWNLOAD/completed /home/pi/MOVIES/HD &>> $LOG_FILE

I would really appreciate some help, maybe there is another tool I can use? I'm stuck and really desperate..

Please help me!
br J
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 16th July 2018 - 01:40 AM