Page 1 of 1

strip numbers from filenames

Posted: Tue Aug 09, 2022 2:22 pm
by MOISES_LOPES
Does anyone know if there is a way in FFAStrans to take numbers from file names for example 14562_nomedoarquivo.mxf

Re: strip numbers from filenames

Posted: Wed Aug 10, 2022 9:07 am
by emcodem
Hi Moises,

welcome to the forum and thank you for using FFAStrans!

Thats easy, use a populate processor, create a new user variable and select your new variable on the left side in the dropdown.
On the right side, you enter some regex, a few examples:

Replace ALL numbers in the original filename, e.g. filename is 123a1b1c123, result is abc:

Code: Select all

$regreplace("%s_original_name%","\d+") 
Replace numbers only from start in the original filename, e.g. filename is 123a1b1c123, result is a1b1c123:

Code: Select all

$regreplace("%s_original_name%","^\d+") 
Replace numbers only between _, e.g. filename is test_123_test, result is testtest:

Code: Select all

$regreplace("%s_original_name%","_\d+_")
Replace numbers only from end of filename and keep original extension: e.g. test123.png -> test.png:

Code: Select all

$regreplace("%s_original_name%","^\d+") & ".%s_original_ext%"
At the end, you can then use a deliver processor and play with "drop original name" (and extension, depending on what regex you choose) and insert your newly created and populated user variable in the prefix field. If your workflow only does renaming, also check the "move instead of copy" field and set %s_original_folder% as target folder.