f2
f2 copied to clipboard
[Help] How to match ISO date string
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
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'