dalance/amber

Ability to preserve timestamps

Closed this issue · 5 comments

Hi,

for some of the sets of files I'm working with, the files' mtime is important.
But when I need to perform some refactoring with them, I want their timestamps to be preserved.

I'm familiar with the other modern search & replacement tools (namely Fastmod and Ruplacer), and oddly enough none of them offers this feature.

Therefore, I'd be much interested if Amber implemented it.

Cheers, and thanks for your work !

Thank you for your suggestion.
What do you think about atime?
I think the following plans.
Which is suitable for your use case?

  1. adding two options

--preserve-mtime: preserve mtime only
--preserve-atime: preserve atime only

  1. adding one option

--preserve-time: preserve mtime and atime

Forgive me for my bad phrasing, which made you think that by timestamps I meant both mtime and atime.
I'm just concerned about the mtime, and I'm pretty sure it would be the same with most people.
The reason is, it's so I/O intensive to maintain access times that most often filesystems are mounted with the noatime option.
I'm confident it's the behaviour chosen by most Linux distributions nowadays.

I'd thus suggest to simply ignore the access time.

I added --preserve-time option, and released v0.5.5.

Wow, thanks very much ! I haven't tested it yet.

Working like a charm... closing as fixed. Thanks again !