File Mover Blog

  • 05 Oct

    How to convert audio from one format to another format

    How to convert audio from one format to another format

    Q: We would like to archive audio, convert from one format and downsample to another format. What I’ve tested is FFmpeg.exe  This program would need to execute a command to convert the original file to another format at the destination. This seems really simple, command line execution, but you would know how best to format this process. We would be copying files from source to destination. Here’s the command we’d execute for each file (obviously the file names would be different for each file).

    ffmpeg -i audio.wav -acodec libmp3lame audio.mp3

    I figured it out how to make this work with 2 rules.

    • First rule to execute the command and convert the files.
    • The second rule to be triggered when the first rule is complete to move the files to central storage. I just processed 145 files and it was effortless.
    One question. IF the command that is being executed in rule 1 has a problem (error message “process already running”) or anything like that, how do I kill the process that is operating in the background? I experienced this when I didn’t have a setting for overwrite, it was looking for a Y or N to continue. I added the setting to overwrite, but if something else comes up?
    • Added CMD (Command Line) as Destination:
    limagito file mover command line as destination
    • Screenshot of the Command settings I used:
      • Command Line: CMD /C “C:\Temp\ffmpeg.exe” -i “%SFP%SFN” -y -ab 48k “%DFP%DFW.mp3”
        • CMD /C: Execute Command and Close afterwards
        • %SFP: Source File Path ( Path ends with a \ )
        • %SFN: Source File Name
        • -y to confirm overwrites without needing a user interference
        • %SDFP: Destination File Path, in this setup it was set to C:\Temp\Test\
        • %DFW: Destination File Name Without Extension

    limagito filemover convert audio

    A: Setup looks good. You need command line switches that do not ask any feedback to the ‘user’. In case of error it should return a value <> 0. I guess it will be possible with ffmpeg.exe and it seems you already did by adding the -y switch.

    If you need any help about this ‘convert audio’ request, please let us know.

    Best Regards,

    Limagito Team

    #ffmpeg #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Command Conversion
  • 04 Oct

    How to move directories by sending an xml to a watch folder

    How to move directories by sending an xml to a watch folder

    Q: I want to move directories recusivly from one volume to another, by sending an xml to a watch folder.

    <Move>
    <Dir Src=”C:\Test\Label\In Dest=”C:\Test\Label\Out/>
    </Move>
    This moves all files and subdirectories from the source to destination, every time I drop a new file into the processing folder. Each xml will contain one entry (Src and Dest). When a xml file is successfully processed it should go to a ‘backup’ folder.
    A: Yes, this should be possible using our Pascal Script option. We’ll read the ‘Scr’ and ‘Dest’ value from the xml, the function and other settings need to be done within our File Mover. Both Src and Dest should be Windows folders or shares. We added an option that will move invalid xml files to an ‘error’ folder.
    • We used the following test folder structure:
    limagito file mover move directories by sending an xml
    • The Xml processing folder contains two subfolders:
      • Backup: when a xml file is successfully processed it should go to a ‘backup’ subfolder
      • Error: invalid xml files will be moved to this ‘error’ subfolder

    limagito file mover move directories by sending an xml

    • Source Setup:
      • Variable %VSA ( Variable String A ) will be set using our Pascal Script option

    limagito file mover windows folder as source

    • Destination Setup:
      • Variable %VSB ( Variable String B )will be set using our Pascal Script option

    limagito file mover windows folder as destination setup

    • Open our Pascal Script option:

    limagito filemover pascal script option

    • Enable and add the following ‘On Rule Begin’ Pascal Script:
      • You can download the script here
      • Do not forget to adjust the Const values
        • ctXmlPath: Path where we need to look for xml files
        • ctXmlErrorPath: Path where we will move invalid xml files to
        • ctRoot, ctChild, ctAttrSrc, ctAttrDest: Where do we need to look in the xml files to find ‘Src’ and ‘Dest’ values.

    limagito file mover on rule begin pascal script

    • Enable and add the following ‘On Rule End’ Pascal Script:
      • You can download the script here
      • Do not forget to adjust the Const values
        • ctXmlBackupPath: Path where successfully processed xml files are moved to

    limagito file mover on rule en pascal script

    • RunTime Log Result:
      • We found a valid ‘xml_processor.xml’ file containing ‘C:\Test\Label\In’ as Src and ‘C:\Test\Label\Out’ as Dest

    limagito file mover runtime log result

    If you need any help about this ‘move directories by sending an xml’ request, please let us know.

    Best Regards,

    Limagito Team

    #xml #managedfiletransfer #filetransfer #filemanagement

  • 28 Sep

    How to wrap any lines longer than say 80 characters

    How to wrap any lines longer than say 80 characters

    Q: Is there a way when moving a text file to wrap any lines longer than say 80 characters?

    A: Yes this possible using the following Pascal Script as Destination

    • Add our Pascal Script option in your Destination setup
      • Don’t forget to adjust the  ctOutputPath  Const value.

    limagito file mover wrap any lines longer than

    Var
      iList: Integer;
      tmpEntry, tmpStrip: String;
      tmpFileIn, tmpFileOut: String;
      tmpListIn, tmpListOut: TStringList;  
    Const
      // Should be different than the Source path, must end with a \
      ctWordWrap = 80;
      ctOutputPath = 'C:\Test\Out_TXT\'; 
    Begin
      psExitCode := 0;
      tmpFileIn := psFilePath + psFileName;
      tmpFileOut := ctOutputPath + psFileName;
      // ... add your code here
      tmpListIn := TStringList.Create;
      tmpListOut := TStringList.Create;
      Try
        Try
          tmpListIn.LoadFromFile(tmpFileIn);
          // Iterate
          For iList := 0 to (tmpListIn.Count-1) Do
          Begin
            tmpEntry := tmpListIn.Strings[iList];
            if Length(tmpEntry) > ctWordWrap Then
            Begin
              Repeat
                tmpStrip := Copy(tmpEntry, 1, ctWordWrap);   
                tmpListOut.Add(tmpStrip);
                tmpEntry := Copy(tmpEntry, ctWordWrap+1, length(tmpEntry)-ctWordWrap);
                If Length(tmpEntry) <= ctWordWrap Then
                  tmpListOut.Add(tmpEntry);   
              Until Length(tmpEntry) <= ctWordWrap;  
            End
            Else
              tmpListOut.Add(tmpEntry); 
          End;
        Except
          psLogWrite(1, '', 'Error handling ' + tmpFileIn); 
        End;
        // Save Result
        Try
          psLogWrite(1, '', 'Saving ' + tmpFileOut);
          tmpListOut.SaveToFile(tmpFileOut);
          // Set Result to Successful
          psExitCode := 1;
        Except
          psLogWrite(1, '', 'Error saving ' + tmpFileOut); 
        End;    
      Finally
        tmpListIn.Free;
        tmpListOut.Free;
      End;    
    End.
    

     

    If you need any help about this ‘wrap any lines longer than’ request, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

1 2 3 4 5 6 164
SEARCH