homepage Welcome to WebmasterWorld Guest from 54.166.122.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Unix cp/mv help
How do I update a directory w/out overwriting?
suga

5+ Year Member



 
Msg#: 4451927 posted 6:42 pm on May 10, 2012 (gmt 0)

Here's my example:

I have a directory called forum with files and subdirectories with files. I want to upgrade my forum and have uploaded the new forum directory. Now, I need to copy the new forum directory over to my existing location but without deleting any of my custom files.

I know this works:

sudo mv /new/forum/*.php /old/forum/.
sudo mv /new/forum/*.jpg /old/forum/.
sudo mv /new/forum/admin/* /old/forum/admin/.

But is there a way to do this without first cd-ing into the directory and moving/copying contents of that directory? Is there a way to do it by whole directory?

sudo mv /new/forum/admin /old/forum/admin

This would simply overwrite the admin directory, right? But what if /old/forum/admin has custom files that I want to keep?

Thanks.

 

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4451927 posted 6:06 am on May 11, 2012 (gmt 0)

if you use 'mv -i /new/forum/ /old/forum/' it will work recursively through the subdirectories and you will be prompted before overwriting any existing files.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved