Conceptually, how do you go about this?
I've got some files that I want to delete from various top-level directories - without changing the directory time stamp.
So:
X/file1
X/file2
X/file3
Y/file1
Y/file2
Y/file3
Z/file1
Z/file2
Z/file3
& I want to delete all the 'file1' from there - retaining the (existing) directory times.
Now I could use something like, FolderTimeUpdate, but depending on the directory layout, it can be quirky in actual operation.
So then I thought, if there were a utility that would delete without touching, but then thought, except for malware writers, probably not.
Something like: rm -r -no-touch file1
I know copy programs can copy with a directory structure, retaining dates.
And I could exclude from the copy unwanted files - like 'file1' - while also retaining copied file AND directory dates.
(FastCopy can do that. Robocopy too, I'm guessing, but didn't look?)
But that the actual copying of files, is not efficient.
Then I thought if I de-dup'd the file1's, by sym-linking them, maybe ? that would not touch the directory dates?
And then if I deleted all those links, except for 1, that maybe ? that too would not touch the directory dates?
(I did not test & still awkward.)
So now, I'm thinking about copying the directory structure (no files) - which will be fast.
Deleting said files ('file1') from the source directories.
Then using the the copied directory date/time (which are* maintained with the copy) as basis to then touch (re-date) the original source directory dates.
So something like this to copy the source directory structure:
robocopy <source> <dest> /e /xf *
robocopy C:\TMP\BRU\BRC .\out2 /e /xf *
And then something like this to re-date the source directory dates:
set source=C:\TMP\BRU\BRC
set copy=C:\out\222\out2
for /D %%i in (*) do touch.exe "%source%\%%i" -r %%i
The -r uses %%i (the copied directory date) as its' time to re-date the source directories.
?
Are*, may depend on the particular copy utility & "quirks" it may have.which are* maintained with the copy