Copy multiple Folders, subfolders, and keep permissions (504 Views)
Reply
Frequent Advisor
marvin51796
Posts: 95
Registered: ‎03-12-2012
Message 1 of 4 (504 Views)

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

 

Honored Contributor
Steven Schweda
Posts: 9,089
Registered: ‎02-23-2005
Message 2 of 4 (495 Views)

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).

Valued Contributor
Ralf Seefeldt
Posts: 167
Registered: ‎04-02-2001
Message 3 of 4 (489 Views)

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

Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 4 of 4 (485 Views)

Re: Copy multiple Folders, subfolders, and keep permissions

[ Edited ]

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
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.