- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: cp command
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
Forums
Discussions
Discussions
Discussions
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
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
04-06-2007 04:47 AM
04-06-2007 04:47 AM
Is there a way to use the cp command to copy a file with absolute path to another directory that would create the paths for you? For example:
I have this file /u01/scripts/sql/test.sql and would like to copy test.sql to /u02. Since I don't have scripts/sql directory created under /u02, the cp -r command won't create it for me. It simply put /u01/scripts/sql/test.sql to /u02/test.sql. In Linux I can use the switch --parents and that creates the directory structure for me. Any help is appreciated.
thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2007 05:15 AM
04-06-2007 05:15 AM
Solutioncp -r /root/testdir1/* /root/testdir2/
Where /testdir2 did NOT exist...
it copies everything over including sub-dir .. /root/testdir2/testdir3/testfile3
But a single file...maybe somebody else can get that one..
Rgrds,
Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2007 05:19 AM
04-06-2007 05:19 AM
Re: cp command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2007 05:25 AM
04-06-2007 05:25 AM
Re: cp command
Thanks again.
TD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2007 06:58 AM
04-06-2007 06:58 AM
Re: cp command
cd /u01
find . -depth | cpio -dumpv /
or the tar version:
cd /u01
tar cf - .|(cd /u02; tar xf -)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2007 01:21 PM
04-06-2007 01:21 PM
Re: cp command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2007 09:15 PM
04-09-2007 09:15 PM
Re: cp command
You can try with the -R option with cp. but this will copy the entire directory to the new locaion.
The command would be
cp -prR u01/scripts /u02
This will create the directories u02/scripts/sql/test.sql and copy the entire contents of the directory scripts to the new location.
Please ignore if you have already tried this option.