Stroller: > > On 18 Feb 2018, at 17:47, Floyd Anderson <f...@31c0.net> wrote: > >> > >> $ cat t.sh > >> #!/bin/bash > >> TMPF=$(mktemp "/tmp/detox_wrapper.$$.XXXXXXXX") > >> for f in "$@"; do > >> touch -r "$f" "$TMPF" > >> detox "$f" > >> touch -r "$TMPF" "$f" > >> done > >> rm -f "$TMPF" > > > > If I’m not totally wrong, the second `touch` cannot work because the file > > that "$f" holds is renamed now. That’s what I mean earlier with iterating a > > list or adapt Stroller’s suggestion. > > How careless of me. > > A solution is to use `detox -v` and capture the output. > > $ touch '1234[]' > $ ls '1234[]' > 1234[] > $ detox -v 1234* > Scanning: 1234[] > 1234[] -> 1234- > $ > > A bit untidy. Really, detox should be patched to check the date and apply it > to the new file.
I must be missing something, but why don't you use plain old mv, it doen't change the times as long you stay in the same file system: $ stat br.log | grep 201 Access: 2018-02-07 22:59:51.746741788 +0100 Modify: 2016-08-16 15:34:40.742454976 +0200 Change: 2018-02-07 12:30:09.737085062 +0100 $ mv br.log z.log | grep 201 $ stat z.log Access: 2018-02-07 22:59:51.746741788 +0100 Modify: 2016-08-16 15:34:40.742454976 +0200 Change: 2018-02-19 16:24:35.662712287 +0100 And regarding detox -v, why not use tr ls -1 | while read a do b=`echo "$a" | tr '[]' '-'` # or whatever mapping you want mv "$a" "$b" done Regards, /Karl Hammar ----------------------------------------------------------------------- Aspö Data Lilla Aspö 148 S-742 94 Östhammar Sweden +46 173 140 57