f2 icon indicating copy to clipboard operation
f2 copied to clipboard

[Help] How to match ISO date string

Open ghost opened this issue 1 year ago • 2 comments

I would like to be able to replace the filenames of multiple files without changing the date/time.

So I have files with multiples dates and times like:

2023-02-23 Filename.pdf | 2023-02-27T16.10.34 Filename.pdf

I want to maintain the date/date-time and rename only the 'Filename'. So:

2023-02-23 NewFilename.pdf | 2023-02-27T16.10.34 NewFilename.pdf

ghost avatar May 01 '23 09:05 ghost

I think the best approach is multiple f2 commands, with decreasing specifics. By hand in serial order or in something like bash.

f2 -f '(\d{4})-(\d{2})-(\d{2})T(\d{2}).(\d{2}).(\d{2}) Filename.pdf' -r '$1-$2-$3T$4.$5.$6 NewFilename.pdf' f2 -f '(\d{4})-(\d{2})-(\d{2}) Filename.pdf' -r '$1-$2_$3 NewFilename.pdf'

joeldebruijn avatar Feb 16 '24 12:02 joeldebruijn