-   Linux - Newbie (
-   -   Moving files and directories except few (

moyorakkhi 10-24-2011 04:20 PM

Moving files and directories except few

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?

Thanks for your help in advance.

thezerodragon 10-24-2011 04:44 PM

rsync should do what you need. Read up on

man rsync
to understand the syntax you will need.

moyorakkhi 10-25-2011 07:49 AM


shopt -s extglob
mv !(fcgi-bin|public_html|awstats|cgi-bin|...) public_html
That resolves it. Can't use rsync because the folder structure in source machine is different.

All times are GMT -5. The time now is 05:52 AM.