Page 1 of 1

Move movies

Posted: 2014-01-20 07:01:49
by al0203
I wonder if there is any way using AMC you can move several selects movies to another directory in the Hdd or to another Hdd. I know that using Shift + Ctrl + M it opens the location of a file and it can be useful if you want to move one, but if you one to move 100 it will take you long time. For example copy/move all the Clint Eastwood movies to an external Hdd.

Posted: 2014-01-20 10:08:14
by antp
It could be done via script probably.
One just has to write it :D

Posted: 2014-01-20 10:41:26
by al0203
antp wrote:It could be done via script probably.
One just has to write it :D
Witch is the function that move/copy the files in AMC?

Maybe generating a bat file and executing it from Ms-Dos?

Posted: 2014-01-20 12:02:00
by antp
I do not if a command for copying/moving file was added. There is a function to launch a command, but as it does not wait for the end of the command before continuing, it would maybe not be a good idea in this case.
So generating a batch file could probably be a better idea indeed.

Posted: 2014-01-20 18:31:47
by soulsnake
Hi,

This is a little script that I have written for me and I use now to copy some movies on an external drive with AMC 4.2.0 Beta.
To use it, it is easy, just change destPath value with the path where you want to copy selected movies.

Code: Select all

program CopyMovies;
var
  destPath: string;
  srcFileName: string;
  destFileName: string;
  log: TStringList;
begin
  if GetIteration = 0 then // Initialisation
  begin
    destPath := 'H:\'; // Change this value with the path where you want to copy movies
    log := TStringList.Create;
  end;
  
  srcFileName := GetField(fieldFilePath);
  destFileName := destPath + ExtractFileName(srcFileName);
  if CopyFile(srcFileName, destFileName, True) then
    log.Add('OK : ' + srcFileName + ' >> ' +  destFileName)
  else
    log.Add('Erreur : ' + srcFileName + ' >> ' +  destFileName);
  
  if GetField(fieldDisks) = '2' then
  begin
    srcFileName := StringReplace2(srcFileName, 'Cd1', 'Cd2', True, False);
    destFileName := destPath + ExtractFileName(srcFileName);
    if CopyFile(srcFileName, destFileName, True) then
      log.Add('OK : ' + srcFileName + ' >> ' +  destFileName)
    else
      log.Add('Erreur : ' + srcFileName + ' >> ' +  destFileName);
  end;
  
  if GetIteration = GetIterationCount-1 then // Finalisation
  begin
    ShowMemo(Log.Text);
    log.Free;
  end;
end.
To move movies instead of copy them, it is the same, just use this function

Code: Select all

MoveFile(ASourceFileName: string; ATargetFileName: string): Boolean;
instead of

Code: Select all

function CopyFile(ASourceFileName: string; ATargetFileName: string; SkipIfExists: Boolean): Boolean;
You can see all this functions with more details in AMC Help (F1).

Note: When the script is launch, you can not stop it and AMC will have some UI freezes but this is normal because AMC copy/move files on the same thread... Something to improve in the future ;).

Soulsnake.

Posted: 2014-01-20 22:21:45
by al0203
soulsnake wrote:Hi,

This is a little script that I have written for me and I use now to copy some movies on an external drive with AMC 4.2.0 Beta.
To use it, it is easy, just change destPath value with the path where you want to copy selected movies.



Soulsnake.
I have AMC 4.1.2.3 version, where can I download AMC 4.2.0 Beta?

Posted: 2014-01-20 22:25:15
by Raoul_Volfoni
al203 wrote:I have AMC 4.1.2.3 version, where can I download AMC 4.2.0 Beta?
here --> [FR][EN] Ant Movie Catalog 4.2.0 [BETA] (03/11/13)

Posted: 2014-03-21 19:30:23
by catalpa
Hi,

i try your script but it produce an error:
"Erreur : >> I:\" (drive letter is ok)
May it don't work with UNC-Path
( \\server\share\file_path ) as
file location?

Thanks

Posted: 2014-03-21 21:55:00
by al0203
catalpa wrote:Hi,

i try your script but it produce an error:
"Erreur : >> I:" (drive letter is ok)
May it don't work with UNC-Path
( \\server\share\file_path ) as
file location?

Thanks
This is the script I finally use:

program MoveMovies;
var
destPath: string;
srcFileName: string;
destFileName: string;
log: TStringList;
ResultPath: string;
begin
if ResultPath = '' then
begin
ResultPath := '---';
Input('Find Duplicates', 'Store results to:', ResultPath);
end;

if GetIteration = 0 then // Initialisation
begin
destPath := ResultPath +'\'; // Change this value with the path where you want to copy movies
log := TStringList.Create;
end;

srcFileName := GetField(fieldURL); //FilePath);
destFileName := destPath + ExtractFileName(srcFileName);
if MoveFile(srcFileName, destFileName) then
begin
log.Add('OK : ' + srcFileName + ' >> ' + destFileName);
SetField(FieldUrl, destFileName);
end
else
log.Add('Erreur : ' + srcFileName + ' >> ' + destFileName);

if GetField(fieldDisks) = '2' then
begin
srcFileName := StringReplace2(srcFileName, 'Cd1', 'Cd2', True, False);
destFileName := destPath + ExtractFileName(srcFileName);
if MoveFile(srcFileName, destFileName) then
log.Add('OK : ' + srcFileName + ' >> ' + destFileName)
else
log.Add('Erreur : ' + srcFileName + ' >> ' + destFileName);
end;

if GetIteration = GetIterationCount-1 then // Finalisation
begin
ShowMemo(Log.Text);
log.Free;
end;
end.

Posted: 2014-03-22 10:45:58
by catalpa
Hi :-)

i think, with your new path requester it is not necessary
to edit the code: "[...] +'\'; // Change this value with [...]"
but i still got a error :-/

"Erreur : \\SERVERPATRICK\Filme2\Movie (2013)\Movie (2013).mkv >> I:\Movie (2013).mkv"

ANT can read/write in "\\SERVERPATRICK\Filme2\", so i think
its not a permission problem, the drive I: is writable too.

Update, found the bug :-)

1.) i use "Source" for the Movie.mkv, also: GetField(fieldSource); //FilePath);

2.) i NOT wants to move! sorry, my mistake.
i want to copy like the first script! while tasting i kill the
two test movies *facepalm* and can't copy them... (logical)

Posted: 2014-03-23 03:43:28
by al0203
catalpa wrote:Hi :-)

i think, with your new path requester it is not necessary
to edit the code: "[...] +'\'; // Change this value with [...]"
but i still got a error :-/

"Erreur : \\SERVERPATRICK\Filme2\Movie (2013)\Movie (2013).mkv >> I:\Movie (2013).mkv"

ANT can read/write in "\\SERVERPATRICK\Filme2", so i think
its not a permission problem, the drive I: is writable too.

Update, found the bug :-)

1.) i use "Source" for the Movie.mkv, also: GetField(fieldSource); //FilePath);

2.) i NOT wants to move! sorry, my mistake.
i want to copy like the first script! while tasting i kill the
two test movies *facepalm* and can't copy them... (logical)
This is the one I have to copy files:

program CopyMovies;
var
destPath: string;
srcFileName: string;
destFileName: string;
log: TStringList;
ResultPath: string;
begin
if ResultPath = '' then
begin
ResultPath := '---';
Input('Find Duplicates', 'Store results to:', ResultPath);
end;

if GetIteration = 0 then // Initialisation
begin
destPath := ResultPath +'\'; // Change this value with the path where you want to copy movies
log := TStringList.Create;
end;

srcFileName := GetField(fieldURL); //FilePath);
destFileName := destPath + ExtractFileName(srcFileName);
if CopyFile(srcFileName, destFileName, True) then
log.Add('OK : ' + srcFileName + ' >> ' + destFileName)
else
log.Add('Erreur : ' + srcFileName + ' >> ' + destFileName);

if GetField(fieldDisks) = '2' then
begin
srcFileName := StringReplace2(srcFileName, 'Cd1', 'Cd2', True, False);
destFileName := destPath + ExtractFileName(srcFileName);
if CopyFile(srcFileName, destFileName, True) then
log.Add('OK : ' + srcFileName + ' >> ' + destFileName)
else
log.Add('Erreur : ' + srcFileName + ' >> ' + destFileName);
end;

if GetIteration = GetIterationCount-1 then // Finalisation
begin
ShowMemo(Log.Text);
log.Free;
end;
end.