Manipulating file modification times in bulk
Nils Kassube
kassube at gmx.net
Sun Sep 29 18:53:18 UTC 2013
Kevin O'Gorman wrote:
> I've got a bunch of SVG files created at various times; these are
> shared with a bunch of folks via a web server.
>
> Some browsers cannot view the raw SVG files, but can view them via an
> HTML file, so what I actually present is a directory of the HTML
> files. These are created by a script and are very simple wrappers.
>
> I would like the file modification times to be changed to the mtime of
> the SVG file. I can see some of the tools to do that, such as
> touch(1) with --date. It's not obvious to me how best to have a
> script acquire the string representation of the dates. Any
> suggestions.
How about this for an individual file?
touch -r filename.svg filename.html
Of course you could do it for all files at once with a short script like
this:
for f in *.svg;do
touch -r "$f" "${f%svg}html"
done
Nils
More information about the ubuntu-users
mailing list