Page 1 of 1

Rename movies and send them to folders according to the initial letter of their name

Posted: 31 Aug 2021, 18:00
by uniqedumx
Here is a more complicated one, I think ... (I don't know anything about this)
:lol: :lol:
thanks to :geek: kim I have this script now .. urra

This is the script:

Code: Select all

{
def mainPath = 'Z:/Cinedriveonline/PELICULAS/'
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, '5 ANIMACION ACORTAR/', norm(ny), fileInfo) ) : ( hd ? allNorm(mainPath, '4 PELICULAS ACORTAR/', norm(ny), fileInfo) : '7 RENOMANUAL/' + norm(ny) )
!(outFull as File).parentFile.exists() ? outFull : allNorm(mainPath, 'DUPLICADA/', norm(ny), fileInfo)
}
What the script does:
1- if the movie belongs to the animation genre, move it to a folder called "5 ANIMACION ACORTAR"
2- THE OTHERS SEND THEM TO "4 PELICULAS ACORTAR"
3- if it gives an error, send it to "7 RENOMANUAL"
4- if it already exists, send it to "DUPLICADA"

What I would like now to automate the result is ...
- if the movie starts with A, move it to folder A, and so on until Z
- That points 1,3 and 4 be maintained
- Point 2 is removed
I take this opportunity to thank your help and the good filebot

Re: Rename movies and send them to folders according to the initial letter of their name

Posted: 01 Sep 2021, 02:51
by rednoah
[SNIPPET] Sort into A-Z folders has some example code for you.

Re: Rename movies and send them to folders according to the initial letter of their name

Posted: 03 Sep 2021, 15:07
by uniqedumx
I already moved him and I have no choice, he sends me to the AZ directory but he does not give me the name of the folder or the name of the film.
I do not know what to change, my programming knowledge is ~ zero

Re: Rename movies and send them to folders according to the initial letter of their name

Posted: 03 Sep 2021, 16:13
by kim
try it:

Code: Select all

{
def mainPath = 'Z:/Cinedriveonline/PELICULAS/'
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, '5 ANIMACION ACORTAR', norm(ny), fileInfo) ) : ( hd ? allNorm(mainPath, az, norm(ny), fileInfo) : mainPath + '7 RENOMANUAL/'+ norm(ny) + '/' + fn )
!(outFull as File).parentFile.exists() ? outFull : allNorm(mainPath, 'DUPLICADA', norm(ny), fileInfo)
}
or

Code: Select all

{
def mainPath = 'Z:/Cinedriveonline/PELICULAS/'
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, '5 ANIMACION ACORTAR', norm(ny), fileInfo) ) : ( hd ? allNorm(mainPath, (n =~ /^(?i)[a-z]/ ? n[0] : '#'), norm(ny), fileInfo) : mainPath + '7 RENOMANUAL/'+ norm(ny) + '/' + fn )
!(outFull as File).parentFile.exists() ? outFull : allNorm(mainPath, 'DUPLICADA', norm(ny), fileInfo)
}

Re: Rename movies and send them to folders according to the initial letter of their name

Posted: 09 Sep 2021, 17:59
by uniqedumx
Gracias amigos,por su gran ayuda, lo he dejado asi muchas gracias......

Code: Select all

{
def altPath = 'Z:/Cinedriveonline/PELICULAS/'
def mainPath = 'Z:/Cinedriveonline/PELICULAS/1 DE LA A-Z y NUMEROS/'
def fileInfo = " - $vf [$mbps]"
def norm = {it.colon(' - ').replaceAll(/[?]/, '').replaceAll(/[!]/, '').replaceAll(/[¿]/, '')};
def allNorm(path, hard, dir, info){ path + hard + '/' + dir + '/' + dir + info };

def outFull = genres.contains('Animación') ? ( allNorm(altPath, '3 ANIMACION', norm(ny), fileInfo) ) : ( hd ? allNorm(mainPath, (n =~ /^(?i)[a-z]/ ? n[0] : '1 CON NUMERACION'), norm(ny), fileInfo) : altPath + '4 RENOMANUAL/'+ norm(ny) + '/' + fn )
!(outFull as File).parentFile.exists() ? outFull : allNorm(altPath, '5 DUPLICADA', norm(ny), fileInfo)
}