Operating System - HP-UX
1748195 Members
3616 Online
108759 Solutions
New Discussion

Re: Copy multiple Folders, subfolders, and keep permissions

 
marvin51796
Regular Advisor

Copy multiple Folders, subfolders, and keep permissions

Is there a way to copy multiple folders and sub folders and keep permissions? I have mulitple folders and each one has subfolders in them, I need to keep owners , groups, permission, etc. This is for a go-live on a new server.

Thanks

 

i know scp and rcp doesnt keep permissions, and i cant tar this stuff up due to size..

thanks

 

3 REPLIES 3
Steven Schweda
Honored Contributor

Re: Copy multiple Folders, subfolders, and keep permissions

> [...] i cant tar this stuff up due to size..

   That might depend on exactly what "tar this stuff up" means to you.

> [...] a new server [...]

   Not a very detailed description of anything.

      uname -a

   A common method is a "tar" pipeline, which does not require saving a
giant "tar" archive anywhere.  For example:

      ( cd src ; tar cf - dir ) | ( cd dst ; tar xf - )

   This simple example depends on transparent access to the source and
destination file systems.  NFS can help for a remote system, or
rsh/remsh or ssh can be used on one side or the other.  Compression
(typically bzip2 or gzip) can be added (to both sides), if the CPUs are
faster than the interconnection.  GNU "tar" or pax may be needed if the
native "tar" program has troubling file-size or name-length limits.
More complex examples abound on the Web (or even on this forum, although
older ones may have been lost in the Great Forum Upgrade).

Ralf Seefeldt
Valued Contributor

Re: Copy multiple Folders, subfolders, and keep permissions

Hi Marvin

 

you although could use rsync, if you don't want to nfs-mount one server to the other.

Check the manual page.

 

Bye

Ralf

Steven E. Protter
Exalted Contributor

Re: Copy multiple Folders, subfolders, and keep permissions

Shalom,

 

Even after years of complaining openssh(secure shell) scp -rp command does not preserve ownership and permissions.

 

What might is doing a read-write NFS mount of the destimation file system and doing a cp -rp command. That command seems to do abetter job.

 

Or using tar to do the job in smaller chunks, though that is clunky.

 

Regards,

 

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com