Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 08-31-2010, 02:10 AM   #1
Registered: Aug 2005
Distribution: Debian Stable
Posts: 218

Rep: Reputation: 17
Is my shell script that has rsync in it working?

I have this script

# Transfers voice files to safe locations
rsync -v -r ./VOICE /media/grandparent/"voice recordings"/"Fall 2010"/
exit 0
And in general, I go into the device that has the script (the subdirs have the voice files), and I execute it.

So far, it has a bunch of voice files, but I'm under the impression it's trying to copy the files all over again rather than check if the files are the same, if so, then just add files that are different or non-existent...

How can I tell it's checking things and making necessary changes rather than uploading every file again?
Old 08-31-2010, 02:19 AM   #2
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288

I think the way that you are trying to quote the white space in the file names might not be working. Also I think you want to use the -u flag so that files that already exist are not copied again. Additionally you might want to use the -a (update) flag instead of just -r. Check the man page for details.

I suspect the following might work for you:

rsync -auv ./VOICE "/media/grandparent/voice recordings/Fall 2020/"

Old 08-31-2010, 02:19 AM   #3
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
You can use the --delete flag.
Old 08-31-2010, 02:22 AM   #4
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 855

Rep: Reputation: 203Reputation: 203Reputation: 203
rsync has too many options to do without knowing he exact requirement. A quick and dirty way may be to write-protect and change the ownership of all destination files before executing rsync and check the exit value. If non zero, then an error. For example 11 is "Error in file i/o" (ref : ). I just googled this.
Old 08-31-2010, 06:39 AM   #5
Registered: Aug 2010
Distribution: Fedora, Centos, Debian
Posts: 49

Rep: Reputation: 7
You can redirect rsync output to log and check it.
-v enables verbose mode.
Anyway rsync -a should do what you need.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] shell script wrapper for automating rsync someshpr Linux - Newbie 3 06-03-2010 02:31 AM
[SOLVED] shell script to copy newly changed files with rsync genderbender Programming 15 04-22-2010 08:27 AM
python rsync script runs from shell not from cron beanbox Programming 3 11-18-2009 07:23 PM
local rsync shell script eradrix Programming 13 07-09-2005 01:57 AM
rsync & scponlyc shell: not working hamish Linux - Software 3 05-28-2005 08:15 AM > Forums > Non-*NIX Forums > Programming

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

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