- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: copying directory structure
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
тАО08-27-2003 05:28 AM
тАО08-27-2003 05:28 AM
I need copy a directory structure from one poit to another ; I've many direcory and sub-directory . I want also maintain owernships and permission.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:30 AM
тАО08-27-2003 05:30 AM
Re: copying directory structure
cd /source_dir
find . -print |cpio -pdumxl /target_dir
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:30 AM
тАО08-27-2003 05:30 AM
Re: copying directory structure
Creating the archive:
find . -type d -print | pax -w -d -f directory.pax
on the destination:
pax -r -f directory.pax
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:31 AM
тАО08-27-2003 05:31 AM
Re: copying directory structure
You can use tar.
tar -cvf
untar in your destination dir
tar -xvf
man tar for more details.
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:31 AM
тАО08-27-2003 05:31 AM
Re: copying directory structure
To copy a directory structure and all files and sub-dirs to another spot on the same machine:
# cp -Rp /dir/to/copy /destination/dir
If you need to transfer to another machine, I'd use tar.
# cd /dir/to/copy
# tar -cvf dir_file.tar .
If you just need the directory structure, I can't think of a good way offhand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:33 AM
тАО08-27-2003 05:33 AM
Re: copying directory structure
Use
cp -r sourceidr targetdir
targetdir should not already exist
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:34 AM
тАО08-27-2003 05:34 AM
Re: copying directory structure
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:40 AM
тАО08-27-2003 05:40 AM
Re: copying directory structure
cd /source_dir
find . -type d |cpio -pdumxl /target_dir
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:41 AM
тАО08-27-2003 05:41 AM
Re: copying directory structure
Try
find . -type d -print |cpio -pdvmux /
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:45 AM
тАО08-27-2003 05:45 AM
Re: copying directory structure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 05:58 AM
тАО08-27-2003 05:58 AM
Re: copying directory structure
Well if it's between systems & it's a one-time shot, then I'd just use tar & ftp
On host1:
tar cvf /tmp/dir_name.tar /dir_name
ftp host2
>put /tmp/dir_name.tar /tmp/dir_name.tar
On host2
tar xvf /tmp/dir_name.tar
Make sure /tmp has enough space - if not use a holding dir that does. This will preserve ownership (provided host2 has the user(s) defined) & permissions.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 06:51 AM
тАО08-27-2003 06:51 AM
Re: copying directory structure
cp_dir()
{
source_dir=$1
target_dir=$2
target_host=$3
cd ${source_dir} ; tar cf - . |
rexec ${target_host} -l root "cd ${target_dir} ; tar xpf -"
cd -
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-27-2003 07:06 AM
тАО08-27-2003 07:06 AM
Re: copying directory structure
fbackup -f - -i /path1 -i /path2 | compress -c | ( remsh otherhost "cd /newpath ; zcat - | frecover -Xx -f - )
Where-
/path1,/path2 are the directories to copy
otherhost is the remote host name
/newpath is where the directories are to be copied
The benefits-
Any ACL info is maintained, and with "compress" the amount of data across the network is kept to a minimum. With fbackup I can select multiple paths, whereas tar is relative to the current working directory.
Downside-
Dependent on "r" commands (remsh,rlogin,rexec) which are not the most secure.
HTH
-- Rod Hills