Solved

sync/copy-overwrite selected directorrys

Posted on 2013-06-19
2
251 Views
Last Modified: 2013-06-21
Hi,

I got as little challenge and would need some assistance since I am scared I mess up all my work.
I made an rsync of my old server to a new one. So basically I have a full copy of the old server.
I now have my sew server ready and over the last 2 weeks copied all my public_http folders from the old copy to my new location.
However since it took a wile to do this I now made another rsync and have updated files.

The issue I am facing is that I like to now not copy all home directorys since I made lots of changes to the html files and settings. Instead I only like to copy the log and maildir directories.

So basically I have

/public_http/username/http
/public_http/username/cgi-bin
/public_http/username/log
/public_http/username/maildir
and
/public_http/mailusers/username/maildir
/public_http/mailusers/username/log

of course I could make an rsync from my old_public_http to the new_public_http. But I only want to overwrite the /log and /maildir folders and not the htdocs and cgi-bin folders.

If these a smart way to do this?

Thank you for your assistance.

Best wishes,
Thomas
0
Comment
Question by:Thomanji
2 Comments
 
LVL 27

Accepted Solution

by:
serialband earned 500 total points
ID: 39260872
You might be able to exclude the folders.
rsync -avz --exclude="/http" --exclude="cgi-bin" /public_http/ remote_server/

or, if there's too many other files, you could just loop through and copy just the log and maildir folders.
 
cd /public_http
for username in * ; rsync -avz /public_http/$username/log/ remotes_server:/public_http/user/log/;rsync -avz /public_http/$username/maildir/ remotes_server:/public_http/user/maildir/; done
0
 

Author Closing Comment

by:Thomanji
ID: 39267568
Thank you for the help
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now