2

I made a terrible mistake while move sites of one server to another. We created virtualhosts in the new server using virtualmin. But while restoring files from old server to new server, I mistakenly copied all files in "/home/VIRTUALHOSTS-NAME/" instead of "/home/VIRTUALHOSTS-NAME/public_html". Now I had to move all files from the home directory of the virtualhosts to the public_html directory except few default folders like: fcgi-bin, public_html, awstats,cgi-bin etc. Can this be automated with a shell script or any command with pipe?

2 Answers 2

6

Assuming your shell is bash,

shopt -s extglob mv !(fcgi-bin|public_html|awstats|cgi-bin|...) public_html 
1
  • Thanks for the tips mates! It worked like charm. Just a little correction, "shopts" didn't worked it's "shopt".. typo :) Commented Oct 25, 2011 at 7:49
0

Yes, rsync is able to do this out-of-the-box. There are many command line parameters to tweak it as you want it.

Assuming you are on an Operating System where rsync is available.

1
  • Well, yes that could be done with rsync but it'll take lots of time to write the script.. because the folder structure was different in the source machine.. I've done rsync on the 2nd server which used as failover.. Commented Oct 25, 2011 at 7:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.