how do i remove a certain word in filename using rename?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
r85w3e9OLsD
Posts: 5
Joined: 31 Dec 2022, 20:48

how do i remove a certain word in filename using rename?

Post by r85w3e9OLsD »

Sorry I'm really kinda noob, mb


currently im using this code, it uses the folder name to rename the mp4 and move the renamed video to a different folder.

Code: Select all

filebot -rename -r C:\Users\admin\Desktop\Download\RandomMovie --file-filter f.video --db file --output C:\Users\admin\Desktop\Download --format "{folder.name}"
however, there are sometime 2-3 files which will make a duplicate names if i use the above code

so i just want remove a certain name on files like "thisiswebsite@" or "website1@" or "thisiswebsite.com@"

also about seperating 4k and non-4k movies folder, would there a query where it says how much filesize will be moved to a different folder? for example 10GB and above

Thanks!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: how do i remove a certain word in filename using rename?

Post by rednoah »

r85w3e9OLsD wrote: 04 Jan 2023, 10:51 however, there are sometime 2-3 files which will make a duplicate names if i use the above code
Your format. Your rules. The {folder.name} is the same for all files inside that folder. You will need to add something else to make the target file path unique for each input file.

e.g. add CRC32 checksum (unique for each file) to the target file name:

Code: Select all

{ folder.name } [{ crc32 }]


r85w3e9OLsD wrote: 04 Jan 2023, 10:51 so i just want remove a certain name on files like "thisiswebsite@" or "website1@" or "thisiswebsite.com@"
e.g. remove arbitrary regex pattern from the file name:

Code: Select all

{ fn.removeAll(/[.a-z0-9]+@/) }
e.g. remove arbitrary regex pattern from the folder name:

Code: Select all

{ folder.name.removeAll(/[.a-z0-9]+@/) }


r85w3e9OLsD wrote: 04 Jan 2023, 10:51 also about seperating 4k and non-4k movies folder, would there a query where it says how much filesize will be moved to a different folder? for example 10GB and above
e.g. generate different file paths for different movies:

Code: Select all

{ gigabytes >= 10 ? '10G Movies' : 'Normal Movies' }
e.g. select only large files in the first place:

Code: Select all

--file-filter "gigabytes >= 10"
:idea: Please read the FAQ and How to Request Help.
r85w3e9OLsD
Posts: 5
Joined: 31 Dec 2022, 20:48

Re: how do i remove a certain word in filename using rename?

Post by r85w3e9OLsD »

Thank you! i will look into it.
r85w3e9OLsD
Posts: 5
Joined: 31 Dec 2022, 20:48

Re: how do i remove a certain word in filename using rename?

Post by r85w3e9OLsD »

sorry for asking another assistance

i tried combining the two code you've provided, i tried doing like this

Code: Select all

filebot -rename -r C:\Users\admin\Desktop\Download\RandomMovie --file-filter f.video --db file --output "{ gigabytes >= 10 ? 'C:\Users\admin\Desktop\Download\' : 'C:\Users\admin\Desktop\Download\10G' }" --format "{ fn.removeAll(/[.a-z0-9]+@/) }" --action TEST
Its giving me an error

Code: Select all

Invalid --output folder: '{ gigabytes >= 10 ? 'C:\Users\admin\Desktop\Download\10G' : 'C:\Users\admin\Desktop\Download' }': java.io.IOException: Bad pathname
Failure (?_?)??
sorry im really noob at this

Thank you
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: how do i remove a certain word in filename using rename?

Post by rednoah »

e.g.

Code: Select all

filebot -rename -r "C:\Users\admin\Desktop\Download\RandomMovie" --file-filter f.video --db file --output "C:\Users\admin\Desktop\Download"
--format "{ gigabytes >= 10 ? '10G/' : '' }{ fn.removeAll(/[.a-z0-9]+@/) }" --action TEST

:idea: --output must be a valid specific existing file path:

Code: Select all

--output "C:\Users\admin\Desktop\Download"
:idea: --format is a format expression that generates different target file paths for different input file paths:

Code: Select all

--format "{ gigabytes >= 10 ? '10G/' : '' }{ fn.removeAll(/[.a-z0-9]+@/) }"
:idea: Please read the FAQ and How to Request Help.
r85w3e9OLsD
Posts: 5
Joined: 31 Dec 2022, 20:48

Re: how do i remove a certain word in filename using rename?

Post by r85w3e9OLsD »

Thanks !!!

That works :)
Post Reply