This might be useful to someone even though it is only tangentially related to 
BBEdit. I spent quite a bit of time (let’s not talk about the hours I spent 
trying to subtract 86,400 seconds from the current date in seconds repeatedly. 
I did get it working, but egads!)  juggling bad ideas before I came up with 
this solution.

I do quite a bit in the BBEdit shell worksheets and I often need to do is touch 
files to update the date stamp and I have a situation where I have several 
hundred files that I need to date stamp with today’s date, yesterdays date, etc 
back for 3 years.

The file names are in the form “nn?n? Name of the file”

1 name of file 1
2 name of file 2
...
99 name of file 99
100 name of file 100

And I need to execute a touch command along the lines of:

touch -t 202004200000  "1 name of file 1"
touch -t 202004190000  "2 name of file 2"
...
touch -t 201912220000  "99 name of file 99"
touch -t 201912210000  "100 name of file 100”

This is the solution I came up with, finally. It does require that you install 
dateutils on your Mac to get gdate (brew install dateutils)

touch -t `/usr/local/bin/gdate --date='today - 99 days' +'%Y%m%d0000’` "99 name 
of file 99”

It is trivial to replace the 99 with the index number of the file. If the file 
doesn’t have an index number, you can use Text => Add/Remove Line Numbers.

Hope this comes in handy for someone.


-- 
'How come you know all that stuff?' 'I ain't just a pretty face.'
        'You aren't even a pretty face, Gaspode.’


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/D02D2F1F-9A58-4C00-8B98-EAABF5B3692E%40kreme.com.

Reply via email to