LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Moving files and directories except few (http://www.linuxquestions.org/questions/linux-newbie-8/moving-files-and-directories-except-few-909887/)

moyorakkhi 10-24-2011 03:20 PM

Moving files and directories except few
 
Hi,

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 03:44 PM

rsync should do what you need. Read up on
Code:

man rsync
to understand the syntax you will need.

moyorakkhi 10-25-2011 06:49 AM

Quote:

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 03:42 PM.