Hi there,
I want to create an AppleScript to rename a selection of files that have the following pattern:
"YYYY-MM-DD [file name referring to content, variable in length] HH-MM-SS.pdf"
(with some of the files lacking the time stamp at the end, others the date stamp at the beginning which in some cases has only the pattern YYYY-MM)
into the pattern "[file name].pdf"
I must admit I am new but have built some small scripts by pasting and copying and modifying what I found in several forums.
I'd procede like this:
I'd tell finder which files to grab:
Get-ChildItem C:\Path\To\Files *.pdf |
now I'd like to tell finder:
if
filename starts with a number
then
search for the delimiter " "
endif
and select all characters before it and delete it /replace this selection with ""
then check if the 8th character before ".pdf" is a number (or otherwise if the 5th one is a number and if so to select the items between the 8th (or 5th) character and the last delimiter "." and erase them.
How would I do this practically? Who can help?
gbu,
kai-uwe
I want to create an AppleScript to rename a selection of files that have the following pattern:
"YYYY-MM-DD [file name referring to content, variable in length] HH-MM-SS.pdf"
(with some of the files lacking the time stamp at the end, others the date stamp at the beginning which in some cases has only the pattern YYYY-MM)
into the pattern "[file name].pdf"
I must admit I am new but have built some small scripts by pasting and copying and modifying what I found in several forums.
I'd procede like this:
I'd tell finder which files to grab:
Get-ChildItem C:\Path\To\Files *.pdf |
now I'd like to tell finder:
if
filename starts with a number
then
search for the delimiter " "
endif
and select all characters before it and delete it /replace this selection with ""
then check if the 8th character before ".pdf" is a number (or otherwise if the 5th one is a number and if so to select the items between the 8th (or 5th) character and the last delimiter "." and erase them.
How would I do this practically? Who can help?
gbu,
kai-uwe