EXTREMELY CHALLENGING -- trying for MONTHS to re-assign file dates stripped by android
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.
Not sure why you think any other OS will do any better a job as a standard copy in any will affect the modification information.
That being said, I did see that rsync has a -t option which specifically says it is there to not alter the modification information:
Code:
-t, --times preserve modification times
I would suggest that you need to review the man page closer and find all the necessary options that will allow you to achieve your task.
I would also add that the process seems a little flawed to me as you are copying all your files to a new location only to then move them again into your 'new structure' which if using cp or mv without options
will also again change the dates / times.
I will finish by saying that all the people on LQ are here because they enjoy what they do and do not expect any remuneration apart from a thank you, so telling us we 'have to' stay with you through the
process may not garner you a lot of responses.
The whole idea of posting onto yet another forum without stating the suggestions so far seems pointless.
Probably any suggestion will be met with "I already tried that" - that will make you even less popular. Yet more time wasted.
I empathize with &hear your extreme frustration &upset.
cp -p --attributes-only? Look into: touch -r OLD NEW (`stat` concept)
Since I'm not good at scripting (nor rsync), I'd simply:
`find` (like ls -R) all the names into 2 *matching* (hugely-long) file lists,
paste oldlist newlist > mycmdlist
then (on mycmdlist) use vi's :%s/^/touch -r /
It produces like: touch -r /path/to/OLD/fileN /newpath/fileN
Of course, try tiny test-cases first. The 2 lists must match exactly.
IF diff systems, find ... -ls|cut -c 61-72 Use touch -d "..." (vi old :%s/$/"/)
Whether or not OP ever reads/tries/is helped by this, or replys, I've enjoyed & learned from working on this. Best wishes.
btw, what "linux forum actually assigns you a person to see your situation through"?
(is it the forum or the [ran-away?] person that "can't find"?)
Hi Eric and welcome to LQ. Your question is both poor, very demanding in title as well as content.
Since you've spent months on this as you say and have written loops, then why don't you take the extra time to post your code and describe your attempts in more, plus much well organized and clearer detail.
Otherwise members here cannot help you if the tone with which you ask comes across as an urgent demand for help to fix something you've spent months on, but still have not too well described.
Note that copy-replace will update the modification date of a file. You've cited partial requirements for your project.
Another tact here is to better understand just exactly what you're attempting and why you're attempting it. You speak of a project and a necessity to start over with an entirely different OS and all.
Partially what you seem to be talking about is merging files between things like source repositories and resolving the differences between various versions.
However you should describe better what you want to accomplish.
If this is similar to what you're doing, there are 2-3 paths, however they are not totally free of effort, or cost. For instance there are commercially supported SCCS software products, they cost a lot, or some cost a lot; however they are worth it. They are not necessarily set up overnight, however they support you to get you going and keep you going, because those products are costly. There are cheaper alternatives, and there are freeware alternatives. You get what you pay for mostly in this situation. While a free tool may be entirely acceptable and do what you need, you also will have no support and therefore have to accomplish the set up and support for it on your own. You also can write your own by writing code and scripts. This is what you've been attempting, unsuccessfully. Another option is to hire someone. There is risk in this also because you don't seem to have a well defined project description and if you hire the wrong person, or even a talented person, but give them poor input as to what you want, you'll expend R&D dollars doing the incorrect choices for your project.
Once again I invite you to elaborate a bit further about your project. However I'll also note that LQ is not filled with members who leap into action to take on some large project that happens to get posted in a thread. Instead LQ members are volunteers where the intentions of the site are to help you to help yourself. Get you through a blocking point. And here you need to describe better where you are at and what your project definition is. If it is "I wish to make a file merge tool", then that's a definition. If the next part is that it needs to be UI based, have a manual merge tool to resolve conflicts and then tag versions in a repository for recall of older versions, then that is a more detailed description.
Last edited by rtmistler; 01-05-2017 at 07:54 AM.
Reason: fix typos
So far, my logic is as follows:
For each file in the NEW-FILE directory,
Find its duplicate in OLD-FILE directory.
Then somehow transfer the date of the file in OLD-FILE directory
to corresponding file in NEW-FILE directory.
It's acceptable to copy the entire OLD-FILE to the NEW-FILE,
replacing it, since the files are identical.
i don't understand.
if you still have the original files, why don't you just delete the copies with the wrong timestamp, and use the originals?
if you need to copy them somewhere, well make sure that the timestamps are preserved.
another question would be:
why do you think you need the file timestamps for these files? what sort of files/structure are we talking here? why is the timestamp essential?
The timestamp would be important in forensic investigations.
I have had people try to say they used a particular version and tried overwriting the correct version with the one they insisted they used. The timestamps said otherwise. They forgot that the timestamp of the module that failed is included in the dump and tried updating the library with an old version.
I've withdrawn the question, which was not formulated per forum guidelines. Thanks to all who responded.
Editing your original post to delete the entire question after receiving a dozen replies is not helpful, nor respectful of those who have replied. It also leaves the the entire thread a confusing and pointless destination for anyone who may arrive here by some future search results - answers with no context at all.
Please don't do that.
If your original question turned out to be not well formulated then you should rephrase the question or add missing details in reply to questions asked by others, per the forum guidelines.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.