How to copy a directory in ant without modifying the sub directories last modified date
-
06-07-2021 - |
Question
Problem:
I have an ant task where I want to copy a folder to a new location but keep all the sub directories last modified date unchanged.
Attempt 1: Looking at the docs I found the preservelastmodified attribute on the copy ant task. I tried that and it preserved the last modified date for the files but not the sub folders.
Attempt 2: I then turned to google and found this, which talks about the problem and then later in the thread talks about using tar or zip for the solution. This does not work either.
Has anyone else run into this? How have you worked around it?
Solution
As far as I can tell, there is no way to do this. I will have to wait until the ant team makes preservelastmodified work for directories like it does for files.