Operating System - HP-UX
1833610 Members
4179 Online
110062 Solutions
New Discussion

Copy files and directories between systems

 
SOLVED
Go to solution
Arne Hillestad
Occasional Contributor

Copy files and directories between systems

I plan to copy a file-system structure ( users $HOME) from one system to another on the network.

By testing with cpio and tar I observe that modification time changes on directories, not on files.

Is there way to avoid this on directories too, or what can I do?

Regards
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: Copy files and directories between systems

Hi:

You are apparently using the '-m' flag with 'cpio' to preserve the modification timestamp of files. According to the man pages, this option affects files and *not* directories.

If you are really concerned about making the directory timestamps the same at your destination, I'd do the copy preserving the *files* modification timestamps, and afterwards 'touch' the directories to update their timestamps (e.g. 'touch -m -t 08010909 mydir').

...JRF...
Sachin Patel
Honored Contributor

Re: Copy files and directories between systems

Hi Knut,
Use rdist it will prerve the time. use rcp with option -p will preserve the time.

Sachin
Is photography a hobby or another way to spend $
Bill McNAMARA_1
Honored Contributor
Solution

Re: Copy files and directories between systems

try rcp -Rp server1:/home /home
rcp -R for recurse and -p for preserve time date permissions attributes...

Later,
Bill
It works for me (tm)
MANOJ SRIVASTAVA
Honored Contributor

Re: Copy files and directories between systems

Hi Knut

Even in tar the - m option would preserve the time stamp .


Manoj Srivastava
weller
Advisor

Re: Copy files and directories between systems

Hello Knut,
you can use tar

cd fromdir ; tar -cf . | ( cd todir ; tar -xf -)

Michael