On Sun, 18 Feb 2018 13:07:33 +0100
[email protected] wrote:
On 02/18 11:38, Stroller wrote:

> On 18 Feb 2018, at 08:21, [email protected] wrote:
>
> when downloading files from non-UNIX sites, they often contain
> "poisonoys" characters like '#', ' ', ''' or that alike.
>
> With the tool 'detox' those filenames could be fixed.
>
> But detox changes the time stamp of the files, which
> filenames are altered (not all files, which are examined).
>
> Is there a way to either get detox not to alter the time stamp

I think:

  tmpfile=/tmp/foo-$RANDOM
  touch -r "$file" "$tmpfile"
  detox "$file"
  touch -r "$tmpfile "$file"
  rm "$tmpfile"

It should be trivial to patch detox to do this itself.

Stroller




Hi Stroller,

this seems to be an egg<->chicken problem.

I like to wrap detox with a script, which will do you magic trick.
Since I want to get rid of those evil characters (...) in the filename,
which normally intercept shell processing, I want to use detox,
which in turn will be called by a shell script in turn, to do the
time machine magic. To do so, I need detox, to sanitize the
filenames from the evil characters, which normally intercept.....
.....stack overflow....recursion depth failure.....process killed.

You know....

I am using zsh...

Any idea to get a chicken OR an egg instead of an scrambled egg with
feathers??? ;)

Go back one step and reread the manual page. It seems to be there is an option ‘--dry-run’ (implies ‘--verbose’) that can probably be used to store a list of the final new file names. Afterwards you can traverse this list with Stroller’s suggestion (slightly adopted of course).

Or you can try other tools which doesn’t use function rename() [1], e.g. perl-rename, and therefore don’t change the last modification time.

Or you can go two steps back and save the file(s) to your like when you download it, e.g. with curl (maybe your’re also interested in its ‘--remote-time’ option).


References:
 - [1] <http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html>


--
Regards,
floyd


Reply via email to