- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- copy directory and all files without overwriting e...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2003 07:37 AM
тАО07-23-2003 07:37 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2003 07:46 AM
тАО07-23-2003 07:46 AM
Solutioncd /directoryB
for file_name in *
do
echo n | cp -pi $file /directoryA
done
This should then do a prompt for each file from directoryB that is encountered in directoryA, and reply to the question with n.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2003 08:04 AM
тАО07-23-2003 08:04 AM
Re: copy directory and all files without overwriting existing files
pathA=/something/here/directoryA
pax -r -w -k -s=$pathA/== $pathA directoryB/
-k option will prevent overwriting of existing files.
-s option is a trick to munge the path names so that files under directoryA are copied relative to directoryB.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2003 08:13 AM
тАО07-23-2003 08:13 AM
Re: copy directory and all files without overwriting existing files
Use option -i with the cp command. See -i option from man page:
Options
-i (interactive copy) Cause cp to write a prompt to standard
error and wait for a response before copying a file that would
overwrite an existing file. If the response from the standard
input is affirmative, the file is copied if permissions allow
the copy. If the -i (interactive) and -f (forced-copy)
options are both specified, the -i option is ignored.
Regards,
Dario
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2003 08:24 AM
тАО07-23-2003 08:24 AM
Re: copy directory and all files without overwriting existing files
How about:
find directoryB | cpio -pdmxlv directoryA
I'd suggest you have a read of the man page for cpio to confirm the options - especially the u option which isn't used to ensure this is what you're after.
regards,
Darren.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2003 03:15 PM
тАО09-08-2003 03:15 PM
Re: copy directory and all files without overwriting existing files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2003 04:55 PM
тАО09-08-2003 04:55 PM
Re: copy directory and all files without overwriting existing files
Bill Hassell, sysadmin