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
urgent help needed!!in copying files to /tmp at boot time,pls help! wrapster UNIX for Advanced & Expert Users 0 04-27-2008 10:00 AM
pERL SCRIPT FOR MONITORING DATE/TIME STAMPS FOR START AND STOP OF APPLICAION IN A LOG FREDDIE091970 Shell Programming and Scripting 4 03-31-2008 09:59 PM
List files with date and time stamps only davewg UNIX for Dummies Questions & Answers 2 01-14-2008 06:33 AM
Copying files created after a specified date/time jm6601 Shell Programming and Scripting 2 11-28-2007 01:29 PM
Copying multiple directories at the same time using Unix JPigford UNIX for Dummies Questions & Answers 9 01-17-2005 05:16 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-04-2005
shyam.appalla shyam.appalla is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 2
Copying Files in the same order along with time stamps

Hi ,

I am New to this group and would like to know if someone can help me on this issue :

We need to copy some files from a particular directory to another directory in the same order and time stamps .How can this be achieved .

For Ex :

./ABC/disk101/XYZ has 1000 files with varying time stamps .Now we have a toch files for all these 1000 files is another directory under XYZ

Now I would like to remove say 100 files and place them in another directory but the order of the files should not change as the files are processed under the same order and the it is like FIFO . How can this be acheived ...

Someone Please Help .
  #2 (permalink)  
Old 12-04-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
I haven't completely understood your question. It seems that you want to copy or move files from one directory to another while preserving their timestamps. To copy, use the command 'cp -p'. The '-p' is to preserve attributes. The mv command automatically preserves attributes of files that it moves.
  #3 (permalink)  
Old 12-04-2005
grahamb grahamb is offline
Registered User
  
 

Join Date: Dec 2005
Location: Windsor, Ont Canada
Posts: 13
Care: There are three time stamps on each file.

Hi Shyam!

As blowtorch says:
1) to remove and place in another directory: use "mv"
2) to copy and preseve the creation time: use cp -p <from> <to>

But you need to understand the different time stamps that a file has, to experiment with these, and decide with time stamp that you want/need to use. Here are some ideas:

A file has three time stamps associated with it, from "man find":
Code:
-mtime : File’s data was last modified
-atime : File was last accessed
-ctime : File’s status was last changed
"mv" will not change the data, but beware: one or both of the other time stamps will change!

Using "ls", you (apparently) are only able to access TWO time stamps (from "man ls"):
Code:
-c with -lt: sort by, and show, ctime (time of last modification of file status information)  with -l: show ctime and sort by name otherwise: sort by ctime
-u with -lt: sort by, and show, access time with -l: show access time and sort by name  otherwise: sort by access time
--full-time like -l --time-style=full-iso
Suggest using: "ls -ltc -full-time" - this would give you a standardised display of time format.

Hope this has been useful.

Regards
GrahamB
Sponsored Links
Closed Thread

Bookmarks

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 02:26 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