Main Area and Open Discussion > Living Room
Renaming query: how to keep e.g. 1a, 1b when renumbering
tomos:
Files (photos) are named numerically, but some are with 'a' & 'b' appended to indicate front & back of same photo.
I want to renumber them sequentially, but again the 'a's and 'b's use the (new) number twice.
e.g. currently:
0822.jpg
0822a.jpg
0823.jpg
* All files have leading zeros i.e. four digits in the number.
* Occasionally files have text after the number, this always following an underscore e.g.
1234_text_added_here
=> there should be no spaces (I can ensure this if necessary by first replacing space with underscore)
As said I want to renumber them sequentially, but again the 'a's and 'b's use the same (new) number e.g. the above list would become
0001
0001a
0002
I would also like to be able to indicate the starting number to use.
I am using directory opus which allows regex (of which I know absolutely nothing).
Dopus's wildcard rename allows sequential renumbering, but I lose the 1a 1b (they would simply become 1a, 2b, etc.
[edit] I dont think dopus wildcard rename can cope with stripping the number & adding a new one -- I would use a different renamer, but I have sorted the files manually in Dopus -- so I'm left with the regex option or one of the scripts mentioned in next post -- at this stage I dont care about losing the 1, 1a, -- simple sequential renumbering would be fine [/edit]
TIA,
tomos:
I see dopus also does Scripts:
* VBA script
* JScript
Renaming query: how to keep e.g. 1a, 1b when renumbering
and the regular rename dialogue
Renaming query: how to keep e.g. 1a, 1b when renumbering
rgdot:
Dont have it currently to test but something like Bulk Rename Utility could be set to ignore/not touch after X positions, so after 4 in your case. Not sure if logic would work but it might.
tomos:
Dont have it currently to test but something like Bulk Rename Utility could be set to ignore/not touch after X positions, so after 4 in your case. Not sure if logic would work but it might.
-rgdot (January 30, 2018, 11:06 AM)
--- End quote ---
I can do that as well with dopus Wildcard rename -- but it then
AFAICS Bulk Rename doesnt recognise that
0810
0810a
should become e.g.
0001
0001a
but will rename them as
0001
0002a
Lintalist:
You can try this AHK script, a quick test shows it here. It will skip files if you only have a/b.
...
0824.jpg ; 0001
0825a.jpg ; will be skipped
0825b.jpg ; will be skipped
0826.jpg ; 0002
...
First it looks for files without a or b.jpg, then copy the files and while it does that tries to see if there are any matching a/b files and if so copy again using the same number.
I'm not a fan of renaming files in script so I've setup a source/target here and it copies so you can check manually before deciding if you want to delete the source files.
--- Code: Autohotkey ---sourcefiles:=""source:=A_ScriptDir "\source\"target:=A_ScriptDir "\target\" Loop, %source%*.jpg { If !RegExMatch(A_LoopFileName,"i)a|b\.jpg") ; we don't to know *a.jpg and *b.jpg files now sourcefiles .= A_LoopFileName "`n" } Sort, sourcefiles, D`n ; sourcefiles:=trim(sourcefiles,"`n") ; MsgBox % sourcefiles Loop, parse, sourcefiles, `n, `r { SplitPath, A_LoopField, OutFileName, , , OutNameNoExt counter:=SubStr("000" A_Index, -3) FileCopy, %source%%OutFileName%, %target%%counter%.jpg IfExist, %source%%OutNameNoExt%a.jpg FileCopy, %source%%OutNameNoExt%a.jpg, %target%%counter%a.jpg IfExist, %source%%OutNameNoExt%b.jpg FileCopy, %source%%OutNameNoExt%b.jpg, %target%%counter%b.jpg MsgBox %source%%OutNameNoExt%.jpg }
Navigation
[0] Message Index
[#] Next page
Go to full version