 |
 |
 |
 |
| Linux Chat The place to talk about anything linux-related outside of Fedora |

29th November 2007, 02:19 AM
|
 |
Registered User
|
|
Join Date: Dec 2005
Location: In your closet
Age: 39
Posts: 2,287

|
|
|
help w/some mv or cp switches
Crap.
I need some help with some mv or cp switches. I'm trying to overwrite a directory with a newer version, but I can't seem to figure out what I'm doing wrong:
I've got /home/schwim/gallery
I've got a new gal dir at /home/schwim/gallery2
I tried cp gallery2 gallery
cp -f gallery2 gallery
cp -rf gallery2 gallery
but the files are not updating. My new files are disappearing, but I have no clue to where
I remember once that my problem was caused by not using /gallery. Is this the case this time? I'd like to know before I try it and I can't find my solution via the Goog.
thanks,
json
__________________
I read the f'ing manual, and it told me to ask you guys...
performing amazing acts of mediocrity since 1974.
-------------------------------------------------------------------
FC 7(32 bit)/Gnome
AMD Athlon 64 3400+
Nvidia 6800 GT
1 Gig ram
|

29th November 2007, 02:27 AM
|
 |
Un-Retired Administrator
|
|
Join Date: Mar 2004
Location: Salem, Mass USA
Posts: 13,934

|
|
|
Make some new folders to try the commands in. Mirrors, if you will, of gallery and gallery2. That way if you screw up nothing is lost. Also, are the files in /gallery going into /gallery2 or is it the other way around. I'm not quite clear. Try the upper case R. Lower case doesn't seem to work very well for me. Seriously.
__________________
Glenn
The Bassinator © ®
Laptop: Toshiba Satellite / Intel Core 2 Duo 1.73 GHz / 2GB / 160GB / Intel Mobile 945GM/GMS/GME/943/940GML Integrated Graphics
Desktop: BioStar MCP6PB M2+ / AMD Phenom 9750 Quad Core / 4GB / 1TB SATA / 500GB SATA / EVGA GeForce 8400 GS 1GB
|

29th November 2007, 02:31 AM
|
 |
Administrator (yeah, back again)
|
|
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 67
Posts: 21,238

|
|
http://www.linuxcommand.org/ Just a refresher but I constantly check it before I play too much.
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651
Don't use any of my solutions on working computers or near small children.
|

29th November 2007, 02:38 AM
|
 |
Registered User
|
|
Join Date: Dec 2005
Location: In your closet
Age: 39
Posts: 2,287

|
|
Bob,
Very awesome site, thanks.
Quote:
mv dir1 dir2
If dir2 does not exist, then dir1 is renamed dir2. If dir2 exists, the directory dir1 is created within directory dir2.
|
Ok, so now I know why it didn't work, however it doesn't tell me how to make it work
Anyone know how to overwrite the contents of gallery with all of the contents of gallery2?
thanks,
json
__________________
I read the f'ing manual, and it told me to ask you guys...
performing amazing acts of mediocrity since 1974.
-------------------------------------------------------------------
FC 7(32 bit)/Gnome
AMD Athlon 64 3400+
Nvidia 6800 GT
1 Gig ram
|

29th November 2007, 02:43 AM
|
 |
Registered User
|
|
Join Date: Jul 2007
Location: Indiana USA
Posts: 1,715

|
|
have you tried:
Code:
cp -f gallery2/* gallery/*
?
__________________
The answer to all of lifes questions are buried somewhere in the Google search engine.
Code:
[Stephen@localhost ~]$ whatis this?
this?: nothing appropriate
|

29th November 2007, 02:44 AM
|
 |
Un-Retired Administrator
|
|
Join Date: Mar 2004
Location: Salem, Mass USA
Posts: 13,934

|
|
|
I'm looking at the man pages for cp and mv. What do you think of cp -u or cp -f ?
__________________
Glenn
The Bassinator © ®
Laptop: Toshiba Satellite / Intel Core 2 Duo 1.73 GHz / 2GB / 160GB / Intel Mobile 945GM/GMS/GME/943/940GML Integrated Graphics
Desktop: BioStar MCP6PB M2+ / AMD Phenom 9750 Quad Core / 4GB / 1TB SATA / 500GB SATA / EVGA GeForce 8400 GS 1GB
|

29th November 2007, 03:01 AM
|
 |
Registered User
|
|
Join Date: Dec 2005
Location: In your closet
Age: 39
Posts: 2,287

|
|
Here's what I'm up to:
Quote:
root@server [/home/info/public_html]# cp -ufR gallery2/* gallery/
cp: overwrite `gallery/modules/webdav/classes/WebDavHelper.class'? ^X
[3]+ Stopped cp -i -ufR gallery2/* gallery/
root@server [/home/info/public_html]#
|
You can see that it's begun asking me if I want to overwrite, although I'm using the force switch.
I have thousands of files in this directory. If I die when I should, I won't be done with this if I have to approve each transaction.
Note that I'm not using the interactive switch, but it's showing up when I stop the command.
Removing update and keeping the force and recursive switch doesn't resolve the issue.
I love the terminal as much as the next guy, but this is bull****.
thanks,
json
__________________
I read the f'ing manual, and it told me to ask you guys...
performing amazing acts of mediocrity since 1974.
-------------------------------------------------------------------
FC 7(32 bit)/Gnome
AMD Athlon 64 3400+
Nvidia 6800 GT
1 Gig ram
|

29th November 2007, 03:24 AM
|
 |
Administrator (yeah, back again)
|
|
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 67
Posts: 21,238

|
|
|
Okay, here's what works for me:
"cp -R -T test test1"
In test, I had included two simple text docs "doc1" and "doc2". In test1, I had substituted the wording a bit but also included "doc1", "doc2" and "doc3".
After the command, I still have my original test, of course, but now test1 contains the "test" doc1, the "test" doc2 and the "test1" doc3.
Before trusting your data, give it a quick try yourself.
(Edit: BTW, that all came from 'man mv' and 'man cp', not from my grey matter - I try to avoid thinking after 9PM and before 8:58PM)
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651
Don't use any of my solutions on working computers or near small children.
|

29th November 2007, 03:33 AM
|
 |
Registered User
|
|
Join Date: Dec 2005
Location: In your closet
Age: 39
Posts: 2,287

|
|
hey there Bob,
The T switch worked locally, but on the server I'm working on (FC4), it states that T is an invalid option
thanks,
json
__________________
I read the f'ing manual, and it told me to ask you guys...
performing amazing acts of mediocrity since 1974.
-------------------------------------------------------------------
FC 7(32 bit)/Gnome
AMD Athlon 64 3400+
Nvidia 6800 GT
1 Gig ram
|

29th November 2007, 03:40 AM
|
 |
Administrator (yeah, back again)
|
|
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 67
Posts: 21,238

|
|
|
Of course, if this is a total replacement not a partial, you could always move the old gallery to /opt or wherever you want, then in your normal directory, the 'mv gallery2 gallery' would work. Finally, just "cd/opt"; "rm gallery". Probably a lot more than that involved, huh?
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651
Don't use any of my solutions on working computers or near small children.
|

29th November 2007, 03:54 AM
|
 |
Registered User
|
|
Join Date: Dec 2005
Location: In your closet
Age: 39
Posts: 2,287

|
|
yeah, there are some files in there created during the install that need to stay in place. Unfortunately, I don't know what they're names & locations are
thanks,
json
__________________
I read the f'ing manual, and it told me to ask you guys...
performing amazing acts of mediocrity since 1974.
-------------------------------------------------------------------
FC 7(32 bit)/Gnome
AMD Athlon 64 3400+
Nvidia 6800 GT
1 Gig ram
|

29th November 2007, 03:55 AM
|
 |
Administrator (yeah, back again)
|
|
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 67
Posts: 21,238

|
|
|
Brain getting foggy, but before it goes completely.... I think the problem can also be solved by 'cd /gallery2' followed by "mv * /home/schwim/gallery" . If you are within the gallery, all that stuff will be moved. I just checked and my same-named docs were replaced while the other ones in my test1 remained intact.
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651
Don't use any of my solutions on working computers or near small children.
|

29th November 2007, 04:09 AM
|
 |
Registered User
|
|
Join Date: Dec 2005
Location: In your closet
Age: 39
Posts: 2,287

|
|
Hey there sir,
Quote:
root@server [/home/info/public_html/gallery2]# mv -Rf * /home/info/public_html/gallery
mv: invalid option -- R
Try `mv --help' for more information.
root@server [/home/info/public_html/gallery2]# mv -f * /home/info/public_html/gallery
mv: cannot overwrite directory `/home/info/public_html/gallery/images'
mv: cannot overwrite directory `/home/info/public_html/gallery/install'
mv: cannot overwrite directory `/home/info/public_html/gallery/lib'
mv: cannot overwrite directory `/home/info/public_html/gallery/modules'
mv: cannot overwrite directory `/home/info/public_html/gallery/themes'
mv: cannot overwrite directory `/home/info/public_html/gallery/upgrade'
root@server [/home/info/public_html/gallery2]#
|
I'm to the point now that it would be quicker for me to wipe out the install, reinstall and manually add back the 100 or so pictures. I've invested an evening in attempting to find a magical switch.
I do appreciate your late night assistance sir
viva la CLI!
thanks,
json
__________________
I read the f'ing manual, and it told me to ask you guys...
performing amazing acts of mediocrity since 1974.
-------------------------------------------------------------------
FC 7(32 bit)/Gnome
AMD Athlon 64 3400+
Nvidia 6800 GT
1 Gig ram
|

29th November 2007, 12:06 PM
|
 |
Administrator (yeah, back again)
|
|
Join Date: Jul 2004
Location: Colton, NY; Junction of Heaven & Earth (also Routes 56 & 68).
Age: 67
Posts: 21,238

|
|
A bright new day has dawned! (Actually looks like might get a foot of lake-effect, but wtf)... Anyhoo....
Played a bit more this AM and looks like 'cp' instead of 'mv' is the ticket. As a test, I took a series of photos and copied them into 'test', including a mixed bag of photos that I put into a 'misc' folder within 'test'. Then, I took a different set of shots and placed them within 'test1', as well as creating a different 'misc' folder of different shots within 'test1'. Now, to the CLI stuff: I 'cd test' followed by:
Quote:
|
[bob1@localhost test]$ cp -R * /home/bob1/test1
|
And Success! Immediately, all the new shots were added to 'test1' and the 'misc' folder contents were immediately added to the 'test1' misc contents. So, 'misc' in 'test' contained 50 shots, while the new 'misc' in 'test1' now contains 77 shots.
As a control, I had also copied my original 'test' into 'test-bkup' and if I cd into /home/bob1/test-bkup/test and then 'cp -R * /home/bob/test1', my contents in 'test1' remain intact.
It's a bit late in the game, but perhaps you can play with this for the next move?
__________________
Linux & Beer - That TOTALLY Computes!
Registered Linux User #362651
Don't use any of my solutions on working computers or near small children.
|

29th November 2007, 01:54 PM
|
 |
Registered User
|
|
Join Date: Jun 2005
Location: Leeds
Posts: 1,264

|
|
|
Sounds like a job for rsync.
Ibbo
__________________
A Hangover Lasts A Day, But Our Drunken Memories Last A Lifetime
--
Linux user #349545
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCfdjyzXscddzQvlhBedAcD7qfKmHo==zx0H
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
KVM Switches
|
keeler1 |
Wibble |
1 |
13th August 2007 11:12 PM |
|
KVM Switches
|
JaSb |
Using Fedora |
6 |
6th November 2004 01:44 AM |
|
gigabit switches
|
redhatgeek |
Servers & Networking |
8 |
21st May 2004 01:00 AM |
Current GMT-time: 03:57 (Sunday, 26-05-2013)
|
|
 |
 |
 |
 |
|
|