LinuxQuestions.org
Visit the LQ Articles and Editorials section
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-31-2010, 01:10 AM   #1
Cyberman
Member
 
Registered: Aug 2005
Distribution: Debian Stable
Posts: 186

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


I have this script

Code:
#!/bin/sh
# 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, 01:19 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,315

Rep: Reputation: 1141Reputation: 1141Reputation: 1141Reputation: 1141Reputation: 1141Reputation: 1141Reputation: 1141Reputation: 1141Reputation: 1141
Hi,

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:

[code]
rsync -auv ./VOICE "/media/grandparent/voice recordings/Fall 2020/"
[\code]

Evo2.
 
Old 08-31-2010, 01:19 AM   #3
quanta
Member
 
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, 01:22 AM   #4
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 627

Rep: Reputation: 137Reputation: 137
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 : http://linux.die.net/man/1/rsync ). I just googled this.
 
Old 08-31-2010, 05:39 AM   #5
goldenbarb
Member
 
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.
 
  


Reply


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


All times are GMT -5. The time now is 05:00 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration