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 .

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.

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":

-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"):

-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