LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-14-2013, 11:05 AM   #1
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Rep: Reputation: 31
rsync - How to skip files that are allready copied?


I want to copy files from /dev/test to /dev/test2
by cron job every night. First time it will copy all files I know.
But next night I want to copy only new files that are created in /dev/test and skip other files.

I see that
Code:
rsync -u --update
skip files are allready copied, but it updates files that changed in /dev/test

I dont want to update changed files. Only to copy new creted files.

I was looking in rsync manual and I didnot see that option. Any idea for that?

Last edited by miros84; 01-14-2013 at 11:06 AM.
 
Old 01-14-2013, 11:12 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
The option you want is "--ignore-existing".
 
Old 01-15-2013, 03:36 AM   #3
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by rknichols View Post
The option you want is "--ignore-existing".
Thank you very much. That seems to be

Well, can I use it
Code:
rsync --ignore-existing
o I have to use it

CODE]rsync -e --ignore-existing[/CODE]
 
Old 01-15-2013, 08:56 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by miros84 View Post
Well, can I use it
Code:
rsync --ignore-existing
That is correct.
Quote:
o I have to use it

Code:
rsync -e --ignore-existing
That is just totally wrong.

You can easily see what rsync would have done by using the "-n" (--dry-run) and "-v" (--verbose) options:
Code:
rsync -n -v ...
 
Old 01-15-2013, 08:59 AM   #5
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Hm..., I see that --ignore-existing is sub-option of -e
I a little bit confused. What if I want to combine more options? I have to separe them only with space?
 
Old 01-15-2013, 12:47 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by miros84 View Post
Hm..., I see that --ignore-existing is sub-option of -e
I don't know what you're talking about. The "-e" (--rsh) option is used to specify an alternative to the default command to run on the remote system for communication between the local and remote copies of rsync. It has basically nothing to do with "--ignore-existing".
Quote:
I a little bit confused. What if I want to combine more options? I have to separe them only with space?
I didn't realize you where that totally unfamiliar with the command line, but yes, that's the most straightforward way to do it. For any option that takes an argument (and for rsync, "-e" is an example of that), the argument must immediately follow the option. The short (single-letter) options can be combined, so "rsync -v -n ..." is equivalent to "rsync -vn ...". I looked around a bit for a decent tutorial on that, but didn't find anything suitable. Anyone???
 
Old 01-15-2013, 02:51 PM   #7
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Well, what makes me confused is that:

Code:
-e, --rsh=COMMAND           specify the remote shell to use
            --rsync-path=PROGRAM    specify the rsync to run on remote machine
            --existing              skip creating new files on receiver
            --ignore-existing       skip updating files that exist on receiver
            --remove-source-files   sender removes synchronized files (non-dir)
            --del                   an alias for --delete-during
            --delete                delete extraneous files from dest dirs
            --delete-before         receiver deletes before xfer, not during
            --delete-during         receiver deletes during the transfer
            --delete-delay          find deletions during, delete after
            --delete-after          receiver deletes after transfer, not during
            --delete-excluded       also delete excluded files from dest dirs
            --ignore-errors         delete even if there are I/O errors
            --force                 force deletion of dirs even if not empty
            --max-delete=NUM        don't delete more than NUM files
            --max-size=SIZE         don't transfer any file larger than SIZE
            --min-size=SIZE         don't transfer any file smaller than SIZE
            --partial               keep partially transferred files
            --partial-dir=DIR       put a partially transferred file into DIR
            --delay-updates         put all updated files into place at end
I have got it from man rsync
I thought that main option is -e and sub option is --ignore-existing

That's because of that way they are presented on man page. Option -e is placed more on the left and I thought is main option.
 
Old 01-15-2013, 09:13 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
It's just that the next 19 options after "-e" don't have a short form, and thus the columns where the short form would be shown are blank. Those are all independent options. For the most part, all of the options are independent, though the list does group similar options together for convenience. The detailed descriptions do list some options that imply, or are incompatible with, others, but the formatting of the summary table doesn't reflect any of that.

Last edited by rknichols; 01-15-2013 at 09:15 PM.
 
1 members found this post helpful.
Old 01-16-2013, 03:47 AM   #9
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Ok, now I undertsand it. Thank you for your explixation.
 
  


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
is it possible to skip the file currently being transfered by rsync? crontab Linux - Software 2 12-30-2012 02:08 PM
[SOLVED] How to tell rsync to skip older files? Clarkman Linux - Software 3 04-19-2012 01:47 PM
Adding files in an allready wrote DVD netpumber Linux - General 3 03-26-2010 06:55 PM
rsync syntax to skip directory, but copy select files.. tnicol Linux - Software 3 07-24-2007 05:40 AM
How to make RSYNC skip a directory due to error message ArchW Linux - Networking 5 07-13-2006 10:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:40 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