Synch only directory sturcture- Help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Synch only directory sturcture- Help
# 1  
Old 03-30-2009
Synch only directory sturcture- Help

Hi All,

I am trying to synchronize two folders(test and test1) using rsync. "test" has some sub folders and all of the have some files also. I just want to sync the directory structure not the files in the first folder with the second. i tried the following script.

rsync -av --include '*/' --exclude '*' test/ test1/

its working fine. now my question is how to exclude only a hidden directory, say .ssh and all other files from each of the directories in the first directory. it would be a gr8 help if some one can help me in this..
# 2  
Old 03-30-2009
You can use something like this:

Code:
cd <source> && find . -name .ssh -prune -o -type d -print |
 cpio -pd <dest>

# 3  
Old 03-30-2009
Sorry, i need to know whether this is possible with rsync or not... bcoz once this is done, i can implement it between two servers.... Thanks for the reply...
# 4  
Old 03-30-2009
I don't know if it's possible with rsync, but you can use cpio between different hosts with ssh.

Assuming the destination directory exists on the remote host:

Code:
cd <source> && 
  find . -name .ssh -prune -o -type d -print |
    cpio -oa | 
      ssh user@host 'cd <dest> && cpio -id'

# 5  
Old 03-31-2009
any possibility with rsync? I cant go back to the junction again and take a new turn. SmilieSmilie. it would be a great help...
# 6  
Old 03-31-2009
i tried

Code:
rsync -av --include '*/' --exclude '*' --exclude '*/.ssh' test/ test1

but its not taking the first exclude...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

NTPD service restart and time synch

I am using ntpd service to sync our RHEL 5.9 system to synch with GPS clock. When I change the RHEL system time more than 7 seconds than the present system time (through "Datetime" command), ntpd service does not adjust the system time to the present GPS time.But if the time is with in 7 seconds,... (6 Replies)
Discussion started by: Anjan Ganguly
6 Replies

2. Shell Programming and Scripting

Time synch monitoring

I'm using a debian variant. My system clock already auto synchronizes. I'd like to have some sort of alert or log entry if the time is ever off by more than a particular amount. My first choice is to have a new file created on the desktop each day that there is a slip greater than the specified... (4 Replies)
Discussion started by: jutnobs
4 Replies

3. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

4. AIX

How to set owner and permission for files/directory in directory in this case?

Hi. My example: I have a filesystem /log. Everyday, log files are copied to /log. I'd like to set owner and permission for files and directories in /log like that chown -R log_adm /log/* chmod -R 544 /log/*It's OK, but just at that time. When a new log file or new directory is created in /log,... (8 Replies)
Discussion started by: bobochacha29
8 Replies

5. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

6. UNIX for Dummies Questions & Answers

Extract directory name from the full directory path in UNIX using shell scripting

My input is as below : /splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt /splunk/scrubbed/rebate/IFIND.REBTE.WROC.txt /splunk/scrubbed/loyal/IFIND.HELLO.WROC.txt /splunk/scrubbed/triumph/ifind.triumph.txt From the above input I want to extract the file names only . Basically I want to... (5 Replies)
Discussion started by: IshuGupta
5 Replies

7. Web Development

Directory index forbidden by Options directive error on specific directory with indexing disabled

I am seeing the following error appear numerous times in my Apache error log: I have my Apache config configured as below, so I would expect indexing not to occur on this directory as it falls under the parent /web directory. Strangely all the IP address, including this example, all... (5 Replies)
Discussion started by: crmpicco
5 Replies

8. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

9. Shell Programming and Scripting

how to synch 2 processes to start at the same time

Hey Excuse me if this question is repeated everywhere but I am still new with scripting and I couldn't apply what I found to my case :confused::confused: I am trying to run a rec process on a ssh client and at the same time play a file from my computer so i tried this #!/bin/bash echo... (3 Replies)
Discussion started by: Antaha
3 Replies
Login or Register to Ask a Question