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

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

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

Post 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
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post by rednoah »

[SNIPPET] Sort into A-Z folders has some example code for you.
:idea: Please read the FAQ and How to Request Help.
uniqedumx
Posts: 11
Joined: 23 Aug 2021, 20:56

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

Post 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
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

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

Post 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)
}
uniqedumx
Posts: 11
Joined: 23 Aug 2021, 20:56

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

Post 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)
}
Post Reply