#1 : 13/01-25 12:56 Malte
Posts: 4
|
hello,
i want to insert a word from a predefined list into filenames. example: list: sound, visual, composit old filenames: test file 1.jpg test file 2.jpg test file 3.jpg new filenames: test sound file 1.jpg test visual file 2.jpg test composit file 3.jpg with a test if the list of words contains as many words as the number of files to be renamed. if i could load the word list from a .txt file that would be a nice bonus. do i need a script or can it be done with build-in features? i am grateful for any help. |
#2 : 13/01-25 13:32 Delta Foxtrot
Posts: 401
|
Reply to #1:
Hi Malte, You don't need a script, you just need to import your text file as data (on the menu it is "Import / Data From CSV"). You'll get a window for CSV file imort; click the "..." button, tell the popup file selector window to show all files and navigate to your text file, then double-click on it. You'll see your list of replacement words; Accept the default values. Once back in the main window drag your files in and make sure they are ordered the same way your text file is. Open a "New name" method and enter this in the New Name field: <word:1> <csv:1> <word:2> <word:3> Apply to Name only and you should see what you want. Screenshot: https://drive.google.com/file/d/1HgYKOHR9BaPUb9u XPI0H9SnDDdISAXba/view?usp=sharing Oh, btw, you'll have to do your own checking to make sure the words match number of files. Shoot us back if you have problems. Best, DF |
#3 : 13/01-25 14:26 Malte
Posts: 4
|
Reply to #2:
thanks for your reply. very helpful. maybe i need to replace a word in the filenames in the future with one of the list. old filenames: test file 1.jpg test file 2.jpg test file 3.jpg new filenames: test cat 1.jpg test mouse 2.jpg test dog 3.jpg also my example was just that. the filenames my look very different. like: what.is.that222.jpg would that still work without a script? i guess <word:1> <csv:1> <word:2> <word:3> would not function correctly in that case? |
#4 : 13/01-25 14:44 Delta Foxtrot
Posts: 401
|
Reply to #3:
Hi Malte, Please include real examples of filenames. It's really hard to help if we don't know what you are working with. In the meantime check out the "default tags" page of the use guide: https://www.advancedrenamer.com/user_guide/v4/ta gs_default The <word> tag is near the bottom of the page. Words are groups of characters NOT in your "Options / Settings / Renaming / Word Separators" field. I think the default contains a period, but if not you'd just add the character to the list. You didn't specify where you'd want the word inserted in that new example, but the <csv> tag will ALWAYS insert whatever is in the file at that spot, so just tailor your list and word separators and you should be golden. Best, DF |
#5 : 13/01-25 15:01 Malte
Posts: 4
|
Reply to #4:
i know, i was kind of unspecific because how i need to use this method will vary. i may have filenames with points like file.for.peter.hegendorf.txt and others with spaces. file copy for julia kemp 12.08.2024.txt and i need to insert the words from the list at a specific place in the filename. it would help the most i guess, when i could place the words from the list after a certain number of characters in the filename or in front of another word that i specifiy. insert word after 5 characters or insert word before "for". these two methods could solve 95% of my renaming problems i guess. i tried a bit with <substr> and that seems to help with the "insert after X characters" method. thanks again for your help, very kind of you. |
#6 : 13/01-25 15:36 Delta Foxtrot
Posts: 401
|
Reply to #5:
Hey Malte, So use a replace method, and try something like this: Replace: <word:1>(.)(.*) With: <word:1> <csv:1>$1$2 Occurrence: All Case sens.: unchecked Use regular expressions: CHECKED Apply to: Name This takes care of your problems. If you have files that don't fit the pattern you can add more replace methods and deactivate the ones that don't apply to the files you are working on. For instance, a replace method like: Replace: (.*)for(.*) With: $1<csv:1>for$2 Will give you the "before for" method. Replace: <substr:1:5>(.*) With: <substr:1:5><csv:1>$1 Will give you the "after x characters" method (change the substr tag values as needed). I suggest you study up on regular expressions. Just a little knowledge of them (as above) can yield amazing results. :) Best, DF |
#7 : 13/01-25 16:14 Malte
Posts: 4
|
Reply to #6:
i will do that. thanks for your help. |