Using Ant Renamer with CLI

Discuss anything related to command line tools here.
Post Reply
Message
Author
User avatar
webfork
Posts: 10818
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Using Ant Renamer with CLI

#1 Post by webfork »

Ant Renamer is simultaneously one of my favorite and most hated programs just because it does everything so well in such a daffy interface.  Anyway, I recently figured out the CLI process and thought it might pay off for someone else.

There's nothing I'm detailing here you can't figure out by digging through the help menu and some trial and error, but maybe this will get you there faster.  I will not guess at how much time the following batch process has saved me, mostly out of embarrassment.

Steps:

1. Open up Ant Renamer and generate some kind of action.  I'm deleting the last 3 characters of a file to kill the version number -- something I do about once a week.

Image

Note that you must create an action and select "Add action to batch" (CTRL+F2) to save the file used later in this process.  You can *click* save but it basically generates a blank file.

2. Save the ".ARB" file to a location of your choice (in this case to your temp folder under \POST_ME\remove_version_number.arb) and create a text file with the following:

Code: Select all

"C:\Temp\PortableApps\AntRenamerPortable\AntRenamerPortable.exe" -b "C:\Temp\remove_version_number.arb" -af "C:\Temp\POST_ME\*.txt" -g -x
3. Save the text file as "rename.bat" or similar and launch

4. With these arguments, the program will execute the change to all files in the \POST_ME folder ending in .TXT and exit.

The website is a little light on CLI info, but the included help file has all the info you need to tweak this process.

---

Related:

* Ant Renamer Official Entry: https://www.portablefreeware.com/index.php?id=66 Primary thread: viewtopic.php?t=4406

* Rename Master from JoeJoeSoft (http://www.joejoesoft.com/vcms/108/) advertises CLI parameters, and appears to have more features.  I used Ant because it's been around forever and is open source.

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

Re: Using Ant Renamer with CLI

#2 Post by vevy »

Thanks. I feel that any batch renamer with no support for sequential rules is not worth its salt. The two I have found (although not an exhaustive search) are ReNamer (liteware by den4b.com) and this.

Very nice that it has CLI support too. Thanks for the info and the tip!

User avatar
Midas
Posts: 6706
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Using Ant Renamer with CLI

#3 Post by Midas »

vevy wrote:I feel that any batch renamer with no support for sequential rules is not worth its salt.

Just curious, doesn't Siren (https://www.portablefreeware.com/?id=1315) fit that bill?

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

Re: Using Ant Renamer with CLI

#4 Post by vevy »

Midas wrote: Wed Apr 29, 2020 5:57 pm
vevy wrote:I feel that any batch renamer with no support for sequential rules is not worth its salt.

Just curious, doesn't Siren (https://www.portablefreeware.com/?id=1315) fit that bill?
I give it a quick try but couldn't find a way to set rules. :?

TP109
Posts: 571
Joined: Sat Apr 08, 2006 7:12 pm
Location: Midwestern US

Re: Using Ant Renamer with CLI

#5 Post by TP109 »

Midas wrote: Wed Apr 29, 2020 5:57 pm Just curious, doesn't Siren (https://www.portablefreeware.com/?id=1315) fit that bill?
Siren can do it although it's more complicated than AntRenamer to use, but it appears capable of performing very sophisticated renaming operations. Siren uses variables and/or RegEx in what it calls a renaming expression. Basic variables can be selected from the element selection which can be opened by clicking the icon to the left of the wand (wizard) icon at the top right of the interface. Expressions are entered into the expression bar and can be saved as favorites and executed from the command line using the /F switch. In addition, various configuration files can be loaded from the command line using the /p switch. There's limited help for command line usage in the regular help menu which can be opened by using F1. More useful, but still limited, command line help can be accessed using the "siren /h" command.

An example command line could look like this:

Code: Select all

siren /d "C:\Documents and Settings\user\desktop\test\Siren Renamer Tests" /f *.pdf.bak /s *.bak /F Uppercase2 /r /q
/d - Selected directory
/f - Filter files to those with a pdf.bak extension
/s - Select all files with *.bak extension
/F - Change filenames of selected files to Uppercase using saved favorite Uppercase2
/r - Execute rename operation
/q - Quit after rename execution

User avatar
Midas
Posts: 6706
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Using Ant Renamer with CLI

#6 Post by Midas »

Some years ago, I extracted whatever help Siren had available into a couple of texts files. Here's the main one, lightly revised and formattted with Markdown...


TP109
Posts: 571
Joined: Sat Apr 08, 2006 7:12 pm
Location: Midwestern US

Re: Using Ant Renamer with CLI

#7 Post by TP109 »

Midas wrote: Fri May 01, 2020 2:24 pm Here's the main one, lightly revised and formattted with Markdown...
Yes, as shown in your document, the key to using Siren is the use of variables along with RegEx or other modifiers.

User avatar
Midas
Posts: 6706
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Using Ant Renamer with CLI

#8 Post by Midas »

Here are the remaining files I had, concatenated into a single one and more heavily edited:



This includes a FAQ, the CLI parameters help output and 13 very detailed case examples.

I think "Q013" of the FAQ may answer vevy's rule question but I'm not the right one to judge.

TP109 wrote:The key to using Siren is the use of variables along with RegEx or other modifiers.

Yes, they're not called RegEx by Siren's author but their function is pretty similar.

TP109
Posts: 571
Joined: Sat Apr 08, 2006 7:12 pm
Location: Midwestern US

Re: Using Ant Renamer with CLI

#9 Post by TP109 »

Midas wrote: Sat May 02, 2020 3:52 pm Here are the remaining files I had, concatenated into a single one and more heavily edited:

I think "Q013" of the FAQ may answer vevy's rule question but I'm not the right one to judge.
Good info, examples are especially useful.

Q013 states that /I is used for loading configuration files, but it's not listed as a command line parameter in the program's help file or on the CLI parameters listed below Q013 on https://rentry.co/siren_faq; instead, /p is listed in both places for loading configuration files. Not sure if either or both would work without experimentation.

Siren uses a modified form of the ARE (advanced regular expressions) flavor of RegEx as a modifier listed in the program's help in Help->Expression->Modifiers->Modification by regular expression. It references http://docs.wxwidgets.org for further information.

Advanced regular expressions (ARE), are basically EREs with some significant extensions. An overview of the ARE implementation can be found at https://docs.wxwidgets.org/3.1.3/overview_resyntax.html.

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

Re: Using Ant Renamer with CLI

#10 Post by vevy »

Midas wrote: Sat May 02, 2020 3:52 pm I think "Q013" of the FAQ may answer vevy's rule question but I'm not the right one to judge.
No, no! I meant sequential rules on the same file batch. For example:
  1. remove a string from all file names.
  2. THEN move "from the eighth character till the next space character" to the end.
  3. THEN add zero padding only to those that have only one digit at the beginning.
    etc

User avatar
Midas
Posts: 6706
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Using Ant Renamer with CLI

#11 Post by Midas »

TP109 wrote:Q013 states that /I is used for loading configuration files, but it's not listed as a command line parameter in the program's help file or on the CLI parameters listed below Q013 on https://rentry.co/siren_faq; instead, /p is listed in both places for loading configuration files. Not sure if either or both would work without experimentation.

Bear in mind that my files are old, older still than Siren's last release. Things might have changed.

I'll be glad to make amendments if errors are duly noted -- I'll even grant editing privileges to anyone so inclined, just send PM.

TP109 wrote:Siren uses a modified form of the ARE (advanced regular expressions) flavor of RegEx...

So, they are RegExes after all. I stand corrected.

vevy wrote:No, no! I meant sequential rules on the same file batch.

I see.That is that, then... :sunglasses:

TP109
Posts: 571
Joined: Sat Apr 08, 2006 7:12 pm
Location: Midwestern US

Re: Using Ant Renamer with CLI

#12 Post by TP109 »

It appears that RegEx is just one of several modifier options, but I'm still tinkering around. I did run into some possible issues with the GUI where filtering doesn't seem to work properly from the GUI, but works perfectly from the command line. However, until I dig in a bit more to positively identify any problems, I probably should withhold further judgement. I currently use BRC (Bulk Rename Commandline) for most of my CLI renaming tasks, but Siren looks to have more options so I'm interested in looking into it further.

User avatar
Midas
Posts: 6706
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Using Ant Renamer with CLI

#13 Post by Midas »

TP109 wrote:I did run into some possible issues with the GUI where filtering doesn't seem to work properly from the GUI, but works perfectly from the command line.

Please report those problems at the official forum topic if you can, so other users can be forewarned. Thanks. :slightly_smiling_face:

Link back to Siren's official forum topic: viewtopic.php?t=25012.

Post Reply