The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create a list of files that were modified after a given date. rkka UNIX for Dummies Questions & Answers 4 01-22-2008 05:12 AM
find files with specific date and time itik AIX 3 01-18-2008 01:21 PM
List files with date and time stamps only davewg UNIX for Dummies Questions & Answers 2 01-14-2008 06:33 AM
Order files by create date mab_arif16 Shell Programming and Scripting 4 05-15-2006 01:04 PM
Comparing files named by date/time gillr UNIX for Dummies Questions & Answers 2 05-30-2005 07:37 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-15-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
retain create/mod date and time of files

Hi,

I have a requirement by which I need to take a snapshot of a certain directory of a certain types of files into a target directory within the same server (HP-UX 9000).
The problem is that the files created in the target directory has the date and time of when the files were copied over.
How do I maintain the date and time the files were modified/created in the source directory. Is there any commands/utilities that will enable this preservation. Anys suggestions/ideas are greatly appreciated. thanks.

Jerardfjay
  #2 (permalink)  
Old 06-15-2005
pixelbeat pixelbeat is offline
Registered User
  
 

Join Date: Jun 2005
Location: Ireland
Posts: 61
I don't know about hpux, but gnu cp has the -a option that does what you want.
Generally tar is available though, so you could do something like

(cd src/dir && tar c -p .) | (cd dst/dir && tar x -p)

You can search for more tar examples at http://www.pixelbeat.org/cmdline.html
  #3 (permalink)  
Old 06-15-2005
jppsatish jppsatish is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 1
processing files an hour before

hi

I guess you can use "find" command with -newer or -mtime option for getting those files. refer man pages for detailes about this command.
  #4 (permalink)  
Old 06-15-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
as far as I know --- the copy utilities generally have a "preserve" option to preserve file attributes ... do a man lookup on cp, tar, cpio, etc. ...

Code:
cp -p sourcefile newfile
tar cfp - source | (cd $destdir; tar xfp -)
  #5 (permalink)  
Old 06-15-2005
d11wtq d11wtq is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 42
Yes it's just the -a option. That preserves ALL attributes. Permissions, ownership, creation time, modification time etc etc etc....

It's what you use for backups
  #6 (permalink)  
Old 06-15-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
thank you all for your input. I shall use one of the above.
Closed Thread

Bookmarks

Tags
cpio, mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0