rename

  • 01 Aug

    Q&A 22: move a file and rename the file so it includes the directory name

    Q: I’m trying to move a file that’s within 1 directory and rename the file so that it includes the directory name

    Source: C:\Source1\File.txt

    Destination: C:\Destination\Source1_File.txt

    I want it to take the directory name that it is contained in, then string it to the front of the filename, but move it to it’s destination C:\Destination\.

    We would only want it to pertain to the previous directory by 1 level.

    • C:\Source1\File1.txt => C:\Destination\Source1_File1.txt
    • C:\Source1\Sub\File2.txt => C:\Destination\Sub_File2.txt

    A: Yes this is possible using some ‘Pascal Script’

    Let’s start with the Source, we added a Windows folder:

    LimagitoX file Mover Windows Folder as Source

    In the ‘Directory Filter’ setup we enabled include scanning of subdirectories (optional, is not a must):

    LimagitoX file Mover Include Subdirectories

    Destinations setup, important the first destination must be a ‘Pascal Script’:

    LimagitoX file Mover Destination Setup

    First Destination should be a ‘Pascal Script’. We used ‘Source1’ as default PreFix for the Source Root Folder (you can adjust this):

    Var
      tmpPos: Integer;
      tmpSubDir: String;
    Const
      ctRootPrefix = 'Source1';
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVSA := '';
      tmpSubDir := '%SFS';
      tmpPos := pos('\', tmpSubDir);
      If tmpPos<>0 Then
      Begin
        psVSA := Copy(tmpSubDir, tmpPos + 1, Length(tmpSubDir) - tmpPos);
        psLogWrite(1, '', 'Stripped Prefix from SubDir: ' + tmpSubDir + ' : ' + psVSA);  
      End
      Else
        psVSA := ctRootPrefix;   
    End.

    LimagitoX file Mover Pascal script

    Second Destination is a windows folder where the source files should be moved/copied to:

    LimagitoX file Mover Windows Folder as Destination

    Enable and setup File Renaming in the Windows Destination:

    LimagitoX file Mover File Renaming

    File Renaming setup:

    • RegEx:   (.*)
    • Replacement:   %VSA_\1

    LimagitoX file Mover File Renaming Setup

    RunTime Log result:

    LimagitoX file Mover RunTime Log

    Output Folder result:

    If you need any help , please let us know.
    Regards,
    Limagito Team
    By Limagito-Team Q&A ,
  • 23 Jun

    Q&A 16: Can I rename files when moving to Windows Folder

    Q: Can I rename files when moving to Windows Folder. How do I rename files when moving to Windows Folder:

      • Current name is 100.pdf
      • New Name should be BOL_100.pdf

    A: Yes we have a file renaming option in our Destinations. Renaming can be done with different Destination types (Windows, FTP, SFTP, …).

    Please open your Destination Setup and select the Rename Tab.

    LimagitoX File Mover enable File Rename

    Setup File Rename

    LimagitoX File Mover File Rename Setup

    If you need any help, please let us know.

    Regards,

    Limagito Team

    By Limagito-Team Q&A
  • 27 Aug

    Considering Limagito as a replacement

    Hi, 

    We’re considering Limagito to replace our current solution. A few questions:
    1. We feed incoming filenames to a PERL script, which outputs the replacement filenames for the files at their destination. How could we accomplish this in Limagito?
    2. ..
    Thanx. Mark.
    Until now this wasn’t possible so we had to add this. To accomplish this we added some extra features to the Command option (v11.8.27.0).
    • Redirect Command Output to PS String Var A (%VSA)
    • Line Number to Redirecy to PS String Var A (%VSA).
    Both options are used to redirect the command output to the Ps string Var A (%VSA) which can be used later in the renaming of the destination filename. Setting the Line Number to 1 will take the first line of the command output. Setting it to 0 will take all available lines of the command output.
    Inline afbeelding 3
    The Perl script (or any other type of script) is triggered in the ‘Before Move/Copy/Delete’ command using the source filename (%SFN) as argument.
    Inline afbeelding 2
    Then we will use this string Var A in the file renaming option of your destination.
    Inline afbeelding 4
    The destination filename will be the output result of the script triggered in the Command option.
    Regards,
    Limagito Team
    By Limagito-Team News , ,
1 2 3
SEARCH