Rsync defined directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Rsync defined directory
# 1  
Old 06-16-2014
Rsync defined directory

i want to copy with rsync a specified (sub)-directory and the according folders and files below. my test failed :

cd /dir
/usr/bin/rsync -ravz -e ssh --include='*/' --include='*/00/*/*' --exclude='*' . remote_host:/tmp

i want to copy in these example the directory "00" and the according folders and files below.

the structure of the directories are :

000001
000001/00
000001/00/dir1
000001/00/dir1/file1
000001/00/dir1/file2
000001/00/dir2
000002
000002/00
000002/00/dir1
000002/00/dir1/file1
000002/00/dir1/file2
000002/00/dir2

regards
# 2  
Old 06-17-2014
Try this:
Code:
rsync -ravz -e ssh */00 remote_host:/tmp

This User Gave Thanks to Smiling Dragon For This Post:
# 3  
Old 06-18-2014
this syntax doesn't do the right copy .

Quote:
rsync -ravz -e ssh */00 remote_host:/tmp
i have now a better version, which do the the right copy
Quote:
rsync -avihz --relative ./*/00 remote_host:/tmp
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. UNIX for Beginners Questions & Answers

Move directory with rsync and delete from source

I need a rsync command which will exclude certain files and directories from source and copy the rest. I got this command working, sudo rsync -avzh --exclude 'bin' --exclude 'braintree' --exclude 'colinmollenhour' --exclude 'composer' --exclude 'doctrine' --exclude 'fabpot' --exclude... (2 Replies)
Discussion started by: Siddheshk
2 Replies

3. Shell Programming and Scripting

rsync: skip mail directory

i want to skip the /home/user/mail directory in an rsync but only in this level not like /home/user/public_html/anotherscript/mail if i have a command like this rsync -av --exclude mail /home/$USER root@$SERVERIP:/home2 does it exclude only the mail directory directly under... (1 Reply)
Discussion started by: vanessafan99
1 Replies

4. Shell Programming and Scripting

rsync multiple directories into single directory on remote

I would like to find and backup all *.mp4 files from /Pictures and its sub-directories and move them to a single directory on a remote. I can find and move the files but I don't want the directory structure...just the files to be placed in a single remote directory. To find my files I use ... (1 Reply)
Discussion started by: wreckedred
1 Replies

5. UNIX for Advanced & Expert Users

How to rsync or tar directory trees, with hidden directory, but without files?

I want to backup all the directory tress, including hidden directories, without copying any files. find . -type d gives the perfect list. When I tried tar, it won't work for me because it tars all the files. find . -type d | xargs tar -cvf a.tar So i tried rsync. On my own test box, the... (4 Replies)
Discussion started by: fld2007
4 Replies

6. UNIX for Advanced & Expert Users

rsync deletes original directory

Hi I have a strange problem. Sometimes when I execute the below command something wierd happens. rsync -avz -e ssh travegre@travegre.net: ../travegre.net/ the folder named "hm" that is held in travegre.net and is coppied along with all the other folders and data at travegre.net, gets deleted... (4 Replies)
Discussion started by: travegre
4 Replies

7. UNIX for Advanced & Expert Users

Why rsync deletes source directory?

Hi I have a strange problem. Sometimes when I execute the below command something wierd happens. rsync -avz -e ssh travegre@travegre.net: ../travegre.net/ the folder named "hm" that is held in travegre.net and is coppied along with all the other folders and data at travegre.net, gets... (1 Reply)
Discussion started by: travegre
1 Replies

8. Solaris

Restricting SFTP user to a defined directory and home directory

Hi, I've created solaris user which has both FTP and SFTP Access. Using the "ftpaccess" configuration file options "guest-root" and "restricted-uid", i can restrict the user to a specific directory. But I'm unable to restrict the user when the user is logged in using SFTP. The aim is to... (1 Reply)
Discussion started by: sftpuser
1 Replies

9. Shell Programming and Scripting

rsync mirror of download directory

I have a download directory for NDM Secure+ to receive files from other system. I need to mirror this directory to another box, but need to skip files that are still coming in. I have no control over file names or destination directories as they are configured on the sending side. How can I... (2 Replies)
Discussion started by: wskibum
2 Replies

10. UNIX for Advanced & Expert Users

rsync: taking advantage of files in different directory other than destination

Dear Folks, I have to backup pgsql database dump everynight on a routine. The database dump actually contains sql(text) statements. The actual size of the database dump is aroung 800 MB. Between two days backup, only few lines of statements are modified/added/deleted. I dont want to do... (1 Reply)
Discussion started by: rssrik
1 Replies
Login or Register to Ask a Question