Page 1 of 1

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

Posted: 25 Aug 2021, 22:47
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(/[!]/, '¡')
}

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

Posted: 26 Aug 2021, 03:23
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.

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

Posted: 26 Aug 2021, 22:25
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]

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

Posted: 26 Aug 2021, 23:37
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.