Help - Search - Members - Calendar
Full Version: Files in wrong directories...
The Planet Forums > Operating Systems > Red Hat Linux
8307c4
Ok, I recently installed a new CP and created two sites, which were already on the server...
Unfortunately the cp put the sites at:
/home/thedomaines/public-html
(and ../cgi-bin)

And I have all of the files here:
/sites/thedomaines/www/html

For the time being I edited httpd.conf so at least the sites work,
but if I ever want to create more in the future... I would like to
have it all under one config.

What can I do, it's more than a few files... gigs...
Jeff
Personally I'd just move the files to the current control panels' default www root. From ssh it would only take a minute to move the files from /public-html/html/ to /public-html/ since you're moving the files on the same partition.
8307c4
cp *.*?

Unless Linux is different from Windows, it would take hours to copy files from one directory to another...
We're talking 200,000-some files and about 6-7 gigs worth, rsync is almost faster.

But I may do that as a last resort, how do I keep the properties and owners?
Was just hoping there was a better way, maybe a symlink but I'm not familiar with that...
markcausa
QUOTE (8307c4 @ Mar 9 2008, 03:05 AM) *
Unless Linux is different from Windows, it would take hours to copy files from one directory to another...

I copy MP3 mixes for our radio station from our DJ's individual FTP directories to our central one every day. If you use a tool like WinSCP that combines FTP with Shell, it will go very quickly.
8307c4
I was thinking anything involving cp is going to be slow due to the fact the files are going to-from the same physical media.
cp / copy works great when moving from one drive to another, but once we start moving Large amounts of files (some of those large as well) around on the same physical disc we run into serious lag due to read-writes all occurring on the same drive.
That and it fails to preserve ownership and attributes (or permissions) (thou the perms can be 'switched' not sure about owners).

When I said gigs I meant gigabytes, so 6 or 7 thousand megs (as in megabytes)... ftp is way too slow, the download isn't too bad but cablemodems like mine are severely restricted on the upload, I might get 75kbps throughput... To move this many files in that quantity takes about a month of dedicated transfers (yes I did it this way once lol).

I thought mv might be the answer, but it is dangerous as the source file disappears in the process, so one mistake and no more source files.
And it doesn't actually copy the file...
rsync is great, but really best used from server-server (as it doesn't preserve owners).

But I found this little trick using tar ...

First cd to the source directory, then:

tar cf - . |(cd /targetdir; tar xvf -)

This, all at once, creates a tar to standard input, then changes to the target directory and un-tars it on-the-fly.
Since it is tar, it maintains all permissions and timestamps, etc.
Any existing files in the target would not be affected unless they had the same names, in which case they would be overwritten.
But you could tweak the tar switches to change that behavior.
Take care of the syntax: that's a "dash" or minus character after the 'cf', and then the dot character, for current directory. then the pipe character, etc.

I just tried it on a smaller site and it went pretty decent.
Not sure if it is faster than the cp command but at least it keeps my permissions / owners.
For the big 6 gig site it took all of 30-45 minutes, maybe an hour.

Source forum:
http://www.linuxquestions.org/questions/li...another-444738/
8307c4
I will say this thou...

First of all thanks for the help, I just realized this problem has been around since hard-drives first came around...
This problem has been around for at least 20 years LOL!
Anytime a large number of files needs moving, but really a whole section of hard drive...
It's one thing if they're on the wrong physical media, like they're on CD-Rom and need to be on the hard-drive.
But funny, it is faster to copy from a CD-rom TO a hard-drive!
Then it gets worse, the files are on the correct hard-drive already!
Just they're in the wrong directory, wow what a hassle.

And yes I'm glad in my case it was 'only' ~6,500 mb's worth.
These new 200gb hdd's out there, I feel sorry if they have to move, say 60 gigabytes.
And to add to the fun you have to do it remotely, on another pc connected to yours via a network cable.
But if it makes anyone feel any better, this same problem existed back in the days of 120mb hdd's and Dos 5.0

So there ought to be a way, if I have 400,000 large files (lets say they sprawl 80 gigs wide in 1,000's of sub-directories), say they are here:
/home/mydomain/www/html
And I need them here:
/home/mydomain/html

There needs to be a simple way to do this, like dropping a directory that's inside a tree.

Windows is the same way (as was DOS), if I have this:
c:/Program Files/Ooops I made a mistake/games/etc...
And I need this:
c:/Program Files/games/etc...

How come I can't just 'drop' the folder 'Ooops' and have the rest of games and it's subdirectories move down?
As things stand I first have to copy /games TO Program Files/ in it's entirety, then delete the whole Ooops sub-tree.
It's a royal pain, to move large amounts of files on one hard-drive, it really is.
Heck as if that's not bad enough I've had deleting take time before, when it's that big of a chunk.
But the worst of it is, hours and hours spent moving files when all that was needed was a directory re-structuring.
One lousy part of the tree, sometimes one little branch is out of place, why this can ruin your day lol.
And that's assuming we have the space, because not even the great Xorg can help you if you're low on disk space.

So there should be, in any OS, a power-user command that allows the admin to restructure the directory tree without physically having to move files. If that's not possible, at least make it be able to 'mirror' two directories, to where the files can be in either one but the pc sees them as being in both (not sure about this one due to physical file duplication issues). But that would be very, very nice.

Just had to get that out, I'm sure it's not the first time it's been said icon_razz.gif
Tomy Durden
Usually, a mv across the same media, as long as it's on the same partition just involves readdressing links on the files and not moving the actual data which should be pretty quick. There's always the option of symbolically linking as well.
8307c4
QUOTE (TP-TDurden @ Mar 9 2008, 04:46 PM) *
Usually, a mv across the same media, as long as it's on the same partition just involves readdressing links on the files and not moving the actual data which should be pretty quick. There's always the option of symbolically linking as well.


Would you kindly post the symlink method?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.