I cannot copy with original timestamp! PLEASE HELP
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I cannot copy with original timestamp! PLEASE HELP
Hi all,
I've knowledge about timestamp and i'm trying to use it in a particular scenario. I've multiple folders inside which are different files. Now I'm trying to copy one file (say xyz) which is present in all the folders but has variation in it's content and time of creation into a let's say foldernew.
I'm trying to do this by copying the file xyz from each folders with the new name xyz_(it's orginal timestamp) into folder new.
Can this be done with a single command or do what should I write in a script to execute this?
Note: I want to add the timestamp of xyz when it is created not of the time of copy.
Last edited by EternalCuriosity; 05-19-2015 at 12:37 AM.
How are you planning to obtain this ?.
Were you able to determine the creation time, you'll need to script it.
Each of the files have their unique creation time if that's what you mean. I was planning for a single command but can you suggest a script that can meet my requirement here?
Thanks but I've already considered that. It preserves the timestamp of the file you are copying but it cannot deal with overwrite issue.
Since the destination folder will already have a file with same name from first copy, all other files from other folders cannot be copied to the destination folder.
You could probably skip the TempFile.EXT middleman and use sed to segment the extension to after the timestamp. Lots of ways, some simpler than others.
It was what I was asking, yes.
Most in fact don't have a creation time. Better be sure you have what you appear to think you have.
Quote:
Basically, "creation date" is a myth. That is an "inode modification date".
I'm sure of it since each files are created in unique date through cronjob and haven't been modified. That's the main reason why there are multiple xyz file in different folders.
Not sure if it will help or not, but if you used the date in the filename when creating files it would make this sort of task easier.
(Maybe just add the creation date to your present filenames, & then copy them over.)
That's the new measure i've taken. But placing the already existing files(and there are lots of them to go through manual rename, which i've considered last resort!) in a folder on the basis of their timestamp is what i'm trying to achieve.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.