LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-24-2011, 03:20 PM   #1
moyorakkhi
Member
 
Registered: Jan 2011
Location: Dhaka
Posts: 80

Rep: Reputation: 1
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.
 
Old 10-24-2011, 03:44 PM   #2
thezerodragon
Member
 
Registered: Apr 2009
Location: Paris, France
Distribution: Fedora 12 Constantine
Posts: 142

Rep: Reputation: 44
rsync should do what you need. Read up on
Code:
man rsync
to understand the syntax you will need.
 
Old 10-25-2011, 06:49 AM   #3
moyorakkhi
Member
 
Registered: Jan 2011
Location: Dhaka
Posts: 80

Original Poster
Rep: Reputation: 1
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.
 
  


Reply

Tags
move, shell scripting



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving directories to new directories keysorsoze Linux - Newbie 2 03-31-2006 07:14 PM
Moving or copying a directory into multiple directories oadvantage Linux - Newbie 3 03-07-2006 03:47 AM
An easy way of moving /home and other directories 1kyle SUSE / openSUSE 1 09-23-2005 02:53 AM
moving directories with FTP illiniguy3043 Linux - Software 2 07-08-2004 12:37 AM
Moving directories to their own partitions bxb32001 Debian 7 12-08-2003 06:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration