Add it to delete scanned film or move it to another place due to duplication

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
uniqedumx
Posts: 11
Joined: 23 Aug 2021, 20:56

Add it to delete scanned film or move it to another place due to duplication

Post by uniqedumx »

Hello friends, here I modified a script, filebot, now I ask if it is possible to add something else:

- if the movie exists in the destination folder then delete the movie from the source
or
- If the movie exists in the destination, move the source movie to another folder

I don't want to overwrite destiny

This is the code...

Code: Select all

{
def norm = {it.colon(' - ').replaceAll(/[?]/, '¿').replaceAll(/[!]/, '¡') + ' (' + y + ') / ' + it.colon(' - ').replaceAll(/[?]/, '¿').replaceAll(/[!]/, '¡') + ' (' + y + ') - ' + vf + ' [' + mbps + '] ' + {Languages}};

genres.contains('Animación') ? '2.PELICULAS ANIMACION/' + norm(n) : hd ? '1.PELICULAS VARIAS/' + norm(n)	: 'error/' + ny.colon(' - ').replaceAll(/[?]/, '¿').replaceAll(/[!]/, '¡')
}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Add it to delete scanned film or move it to another place due to duplication

Post by rednoah »

:!: Your custom format generates the destination path. However, writing a format that internally generates and checks multiple file paths and then only returns on of them, is going to be tricky. You will need some programming expertise for that one. The Sort into drive with the most free space can serve as a starting point though.


:arrow: You may be able to write a Custom Rename Action shell script. Check source path / destination path, and then perform the desired actions depending on the situation. This approach might be more easy, but will still require some shell scripting skills.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Add it to delete scanned film or move it to another place due to duplication

Post by kim »

This took some time... try it out:

edit mainPath and altPath first

Code: Select all

{
def mainPath = 'D:/Filmz/'
def altPath = 'D:/Other/'
def fileInfo = " - $vf [$mbps] $Languages"
def norm = {it.colon(' - ').replaceAll(/[?]/, '¿').replaceAll(/[!]/, '¡')};
def allNorm(path, hard, dir, info){ path + hard + dir + '/' + dir + info };

def outFull = genres.contains('Animación') ? ( allNorm(mainPath, '2.PELICULAS ANIMACION/', norm(ny), fileInfo) ) : ( hd ? allNorm(mainPath, '1.PELICULAS VARIAS/', norm(ny), fileInfo) : 'error/' + norm(ny) )
!(outFull as File).parentFile.exists() ? outFull : allNorm(altPath, 'Folder/', norm(ny), fileInfo)
}
sample
D:/Filmz/1.PELICULAS VARIAS/The Movie (2021)/The Movie (2021) - 1080p [9.0 Mbps] [eng, spa]
or
D:/Other/Folder/The Movie (2021)/The Movie (2021) - 1080p [9.0 Mbps] [eng, spa]
uniqedumx
Posts: 11
Joined: 23 Aug 2021, 20:56

Re: Add it to delete scanned film or move it to another place due to duplication

Post by uniqedumx »

Orale, friend you are very good at this, hehe, thank you very much, this group has really helped me a lot, and filebot is the best with scripts

Thank you all.
Post Reply