Renaming folders or files

If you need help on how to use the program
Post Reply
z3us
Posts: 86
Joined: 2008-02-19 17:36:53

Renaming folders or files

Post by z3us »

Hi
I´ve my video files in individual folders for each film. Is it possible to rename the name of the folder (or of the files) with this format?
Translated name (year)

Thanks
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Hi,
See viewtopic.php?t=4460 which seems to do what you want
edit:
but I see that I already gave you that URL on viewtopic.php?t=4765 :D
Last edited by antp on 2011-12-29 21:14:16, edited 1 time in total.
soulsnake
Posts: 756
Joined: 2011-03-14 15:42:20
Location: France

Post by soulsnake »

If you have the full path of movie file in a field you can use the script RenameFiles to rename files.
You can download last version here: http://mickaelvanneufville.online.fr/AMCU/scripts
This script has been done by myself for my personnal use at the beginning. So use it with caution.
First, use script option to choose how to format the new file name.
When you run the script, first choose the field where the file name is stored.
Second, you can enter folder path if you just have the file name stored and not full path (it is my case).
This last option works only if files are in the same specified folder.
For your case you need to have full path of file in a field and leave folder path option blank.
You can also modify script for your personnal use.
z3us
Posts: 86
Joined: 2008-02-19 17:36:53

Post by z3us »

antp wrote:Hi,
See viewtopic.php?t=4460 which seems to do what you want
edit:
but I see that I already gave you that URL on viewtopic.php?t=4765 :D
I didnt remember that, sorry
Pumprdlicek
Posts: 1
Joined: 2015-10-08 11:41:41

Post by Pumprdlicek »

soulsnake wrote:If you have the full path of movie file in a field you can use the script RenameFiles to rename files.
You can download last version here: http://mickaelvanneufville.online.fr/AMCU/scripts
This script has been done by myself for my personnal use at the beginning. So use it with caution.
First, use script option to choose how to format the new file name.
When you run the script, first choose the field where the file name is stored.
Second, you can enter folder path if you just have the file name stored and not full path (it is my case).
This last option works only if files are in the same specified folder.
For your case you need to have full path of file in a field and leave folder path option blank.
You can also modify script for your personnal use.
Hi,
I tried use your script to rename my files, but it doesn't work. I tried to change code little bit and I think script doesn't take value from ExtractFilePath(filename) and it doesn't matter which options I choose in GenerateFilenameWithGetOptions. Everytime it's same.

Example:
OriginalTitle - Cloudy with a Chance of Meatballs 2
TranslatedTitle - Zataženo, občas trakaře 2
Result, if I choose field selection by TranslatedTitle - [0003] Zataženo, občas trakaře 2 [Cloudy with a Chance of Meatballs 2] 2013.avi
fulvio53s03
Posts: 744
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

Will you try this?
You can also modify script for your personal use.

Code: Select all

(***************************************************

Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/

[Infos]
Authors=Fulvio53s03
Title=crea nomi films
Description=crea nomi films
Site=
Language=?
Version=1.1
Requires=4.1
Comments=After importing informations from movies contained in a folder and after importing informations about movies from internet...... this Script will Rename your movies' file names (contained in field File Path) using these optional criterias:    1) Translated Title or original Title or Formatted Title     2) Director (Between Brackets)     3) Year     4) Languages            i.e. from "Y:\Film\Film da catalogare\The Machinist (2004) 1080p.mkv"  you can obtain ""L'uomo Senza Sonno (The Machinist) (Brad Anderson) 2004 ENG, ITA, ENG.mkv".       Using it, you will obtain a file named c:\rename.bat.txt (or any other name you choose) that you can open with notepad, control it, rename in c:\rename.bat and then execute it.         The script can updates field File Path in Catalog or leave it unchanged (default),             Obviousely...... be careful!!!
License=GPL
GetInfo=0
RequiresMovies=1

[Options]
Title=1|1|0=Formatted Title|1=Translated Title|2=Original Title
Director=1|1|1=Yes|0=No
Year=1|1|1=Yes|0=No
Languages=1|1|1=Yes|0=No
Update_path=0|0|1=Yes|0=No

[Parameters]

***************************************************)

program CreaNomiFilm;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  NewName, estensione: string;
  ResultPath: string;
  Titlenew, Linguaggi, CampoAnno, OldPath, NewPath: string;
  Titolo, Regista, Anno, Lingue, PosBar, Aggiorna_path: integer;
  Giri, giri_fatti, lgth_path, ctr_variati: integer;

Procedure ChangeLanguages;
  begin
    Linguaggi := AnsiUpperCase(Linguaggi);
    Linguaggi := StringReplace(Linguaggi, 'ENGLISH', 'ENG');
    Linguaggi := StringReplace(Linguaggi, 'SPANISH', 'ESP');
    Linguaggi := StringReplace(Linguaggi, 'FRENCH',  'FRA');
    Linguaggi := StringReplace(Linguaggi, 'ITALIAN', 'ITA');
    Linguaggi := StringReplace(Linguaggi, 'GERMAN', 'DEU');
end;

procedure Elaborazione;
begin
       NewName := '"';
       if Titolo = 1
          then NewName := Newname + Getfield(fieldTranslatedTitle);
       if Titolo = 2
          then NewName := Newname + Getfield(fieldOriginalTitle);
       if Titolo = 0
          then NewName := Newname + Getfield(fieldFormattedTitle);
       if regista = 1
          then NewName := NewName  + ' (' + Getfield(fieldDirector) + ')';

       CampoAnno := Getfield(FieldYear);
       if Anno = 1
          then NewName := NewName  + ' ' + CampoAnno;

       Linguaggi := Fulltrim(Getfield(FieldLanguages));
       ChangeLanguages;
       if length(Linguaggi) > 0
          then Linguaggi := ' ' + Linguaggi;
       if Lingue = 1
          then NewName := NewName + Linguaggi;

       estensione :=  getfield(fieldvideoformat);
       if   (estensione = 'AVC')   or (estensione = 'mkv')
         or (estensione = 'avi')   or (estensione = 'asp')
         or (estensione = 'mp4')
         then ctr_variati  := ctr_variati + 1
       else ShowMessage('errore estensione ' + Newname);
       

       if (estensione = 'AVC')   or (estensione = 'mkv')
          then NewName:= NewName + '.mkv';
       if (estensione = 'avi')   or (estensione = 'asp')
          then NewName:= NewName + '.avi';
       if estensione = 'mp4'
          then NewName:= NewName + '.mp4';


       OldPath := getField(FieldFilePath);
       lgth_path := length(Oldpath);
       If Aggiorna_path = 0
          then lgth_path := 0;
       If lgth_path > 0 then
         begin
         PosBar := AnsiLastPosEx('\', OldPath, true, true);
         if   PosBar > 0 then
           begin
           delete(OldPath, (posbar + 1), (lgth_path - PosBar));           //cut old filename
           Newpath := Oldpath + stringReplace(NewName, '"', '');
           SetField(FieldFilePath, Newpath);
           end
         end

       if length(getField(FieldFilePath)) > 0 then
          begin
          Titlenew := 'ren "' + OldPath + '"     ' + NewName + '"';
          DupList.Add(Titlenew)
          end
          else
          begin
          NewName := StringReplace(NewName, '"', '');
          Titlenew :=  NewName;
          DupList.Add(Titlenew);          //scrivi riga
          end
end;
//
//MAIN PROGRAM
//
begin
  if StringUtils1_Version < 3 then
  begin
    ShowMessage('File "stringutils1.pas" is too old, please download a new version of it');
    Error;
  end;
  if ResultPath = '' then
    begin
    ResultPath := 'c:\rename.bat.txt';
    Input('Update/Aggiorna Films', 'Store results to: / Salva Risultati in: ', ResultPath);
    Titolo := GetOption('Title');
    Regista := GetOption('Director');
    Anno := GetOption('Year');
    Lingue := GetOption('languages');
    Aggiorna_path := GetOption('Update_path');
    if Aggiorna_path = 1 then
      begin
      ShowMessage('Attenzione! State per modificare il campo "file path" dei film nel Catalogo!         Advertence! You are going tu update field "file path" in Catalog!');
      end
    if Aggiorna_path = 0 then
      begin
      ShowMessage('Attenzione! Il campo "file path" dei film nel Catalogo non verrà aggiornato!         Advertence! Field "file path" in Catalog will not be updated!');
      end
    giri := GetiterationCount;
    if MovList = nil then
       MovList := TStringList.Create;
    if DupList = nil then
       begin
       DupList := TStringList.Create;
       end
    end;
    Elaborazione;

  giri_fatti := GetIteration;
  if giri_fatti = Giri-1 then            //fine elaborazione
       begin
       Titlenew := 'pause';
       DupList.Add(Titlenew);            //scrivi riga
       DupList.SaveToFile(ResultPath);   //chiudi file
       end
end.
:)
Post Reply