rsync and mtime


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers rsync and mtime
# 1  
Old 12-01-2011
rsync and mtime

Hi, I'm sure this will be covered here already somewhere, but a search didn't throw up anything.

I'm trying to work out the extra bits needed in this command for this rsync so that it only copies files less than 7 days old:

Code:
rsync me@host:/logs/* .

I'm sure it just needs the mtime -7 command somewhere in that, but I'll be darned if I can work out where.

Thanks for any advice

Last edited by jim mcnamara; 12-02-2011 at 11:53 AM.. Reason: code tags please
# 2  
Old 12-02-2011
You need to build an exclude file:
Code:
ssh me@host ' find /logs/ -mtime +7 > /tmp/excludefile'
scp me@host:/tmp/excludefile .
rsync --excludefrom=excludefile  me@host:/logs/* .

# 3  
Old 12-05-2011
Hi thanks for that, but I've finally worked out the syntax for doing it as a one liner.
Code:
rsync me@host:'`find /logs/* -mtime -7 -print`' .


Last edited by Scott; 12-05-2011 at 04:56 AM.. Reason: Code tags, please...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Red Hat

-mtime command

Hello, what this command do. find /oracle/u01/app/oracle/admin/rdz/udump/ -name "*.trc" -mtime +1 Thanks, Umair (1 Reply)
Discussion started by: umair
1 Replies

3. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

4. AIX

-mtime Problem

Hi, I'm using command "find . -mtime +10 -type f -print" to list the files 10 days or older but I'm getting the files which are even created today. What am I doing wrong? Thanks. (1 Reply)
Discussion started by: Gbyte
1 Replies

5. Shell Programming and Scripting

mtime

Hi, I've some files of some past days and everyday some new files are also getting added to the same. Now how can i use mtime to get the files of the current date i.e if i want the files of 25th feb 2009 and if im finding the files on 25th 12:10 am then i should only get the files after... (4 Replies)
Discussion started by: ss_ss
4 Replies

6. UNIX for Dummies Questions & Answers

-mtime +30

Hello, Can someone help me to understand the following: find /test/rman/ -mtime +30 -exec rm '{}' \; What does -mtime +30 mean? Thanks! (1 Reply)
Discussion started by: Blue68
1 Replies

7. Shell Programming and Scripting

problem in mtime

Hey champs, i am using the following commands to search 1day files available under a dir by shell script. find <dirname> -type f -mtime +1 sometimes it used to show me correct results.....but sometimes it's not ??? if the above one not working perfect i.e. not showing me the exact... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

8. Shell Programming and Scripting

mtime

hi, :) consider the following statement find . -type f -mtime -1 -print here what is the use of -1 option. any help? cheers RRK (7 Replies)
Discussion started by: ravi raj kumar
7 Replies

9. UNIX for Dummies Questions & Answers

mtime help!!!!!

thank you for the help. (2 Replies)
Discussion started by: scooter17
2 Replies

10. UNIX for Dummies Questions & Answers

find . -mtime

...what am i doing wrong?? I need to find all files older than 30 days and delete but I can't get it to pull details for ANY + times. The file below has a time stamp which is older than 1 day, however if I try and select it using any of the -time flags it just doesn't see it. (the same thing... (1 Reply)
Discussion started by: topcat8
1 Replies
Login or Register to Ask a Question