Operating System - HP-UX
1836428 Members
3571 Online
110100 Solutions
New Discussion

Retain original date when using CP command

 
SOLVED
Go to solution
Peter Chuang
Frequent Advisor

Retain original date when using CP command

Our company is using online backup. I use NFS to copy K570 server data files into Network Attached Storage device, but the date of the folders and files are today's date. What is the command to copy files and folders to retain the original date from the K570 server? Thanks.

Peter
4 REPLIES 4
Geoff Wild
Honored Contributor
Solution

Re: Retain original date when using CP command

cp -p

or

scp -p


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: Retain original date when using CP command

Or better yet:

cd /mount/point/to/backup
tar -cvf - . | ssh nasserver 'cd /destination/folder ; tar -xf -'

or if a local mount

cd /mount/point/to/backup
tar -cvf - . | (cd /destination/folder ; tar -xf -)

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Jeeshan
Honored Contributor

Re: Retain original date when using CP command

Hi

take a look at this thread

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1215148
a warrior never quits
Peter Chuang
Frequent Advisor

Re: Retain original date when using CP command

Thanks for all the help.