• 23 Apr

    Moving a file based on specific filename part to specific folder

    Q: Moving a file based on specific filename part to specific folder

    Hi there, looking if your software can do this please.

    1) Look at a filename, parse out from character 8-16 and capture it as a ID number

    2) look at the subfolders, find folder with same name, if doesn’t exist, create.

    3) move the file to that location.

    Here is some more specific example

    PDF Name: 055400E900105028-DEN-20210412_12.pdf

    Folder name to search for, and if not exists, create and move the data.

    900104028

    The bolded number is the ID number we need to catch/reference.

    I think it could just skip the file in this ‘rule’ if the length of the file is not ok which would mean it doesn’t contain an ID number.

    For this 1 rule/purpose these files come from a third party provider which should be pretty consistent and contain that number.

    The problem is some folders contain only the ID and is missing the buffer 0’s we put in front.

    So pdf may say 000000465 but the folder that already exists may be called 465 ☹

    Hopefully your tool can assist in more than one way (which it looks like it can!)

    A: Yes this should be possible. We prepared some screenshots to get you started.

    1.You can use any Source but in this example we used a WIN folder:

    Limagito File Mover WIN as Source

    2. File Filter Setup

    The minimum file length we need is 20 (this includes the file extension). We are using the RegEx Include File Filter:

    ^[^|/\<>:?”*]{20,}$

    Limagito File Mover minimum length filter

    3.Now we need some Pascal Script to achieve the customer request:

    Be sure to set the ctOutputPath Constant to the Destination path you are using. In our example the Destination path will be ‘C:\Test\Out_Pdf\’.

    When the File ID starts with 0 then we’ll check if the ID as subfolder exists without the zeros. If it exists we’ll use that one but when not, then the complete ID will be used to create a new destination subfolder.

    Limagito File Mover Pascal Script option

    Var
      tmpDummyPath: String;
      tmpSubPath: String;
    Const
      ctOutputPath = 'C:\Test\Out_Pdf\';
    Begin
      psExitCode := 0;
      tmpSubPath := Copy(psFilename, 8, 9);
      psLogWrite(1, '', 'Stripped ' + tmpSubPath + ' from ' + psFilename);
      //
      IF Copy(tmpSubPath, 1, 1) = '0' Then
      Begin
        If Not DirectoryExists(ctOutputPath + tmpSubPath) Then
        Begin
          tmpDummyPath := tmpSubPath;
          Repeat
            tmpDummyPath := Copy(tmpDummyPath, 2, length(tmpDummyPath) - 1);
            If DirectoryExists(ctOutputPath + tmpDummyPath) Then
            Begin
              tmpSubPath := tmpDummyPath;
              Break;
            End;                  
          Until Copy(tmpDummyPath, 1, 1) <> '0';     
        End;  
      End;
      // The End
      psVSA := tmpSubPath;
      // Check
      If psVSA <> '' Then
        psExitCode := 1;
    End.

    Limagito File Mover On Destination Pascal Script

    4. WIN as Destination setup. Important because for this request we need a WIN as Destination.

    Limagito File Mover WIN as Destination

    Important, be sure the ctOutputPath Constant in the previous Pascal Script is the same as this path.

    Limagito File Mover WIN as Destination Path

    Please enable and set the Create SubDir option to:  %VSA

    Limagito File Mover WIN as Destination SubPath

    5. Result

    Source Files:

    The file RegEx filter will ignore a file when its length < 20. In this case file ‘055400E9001050.pdf’ will not be used.

    Limagito File Mover Source Files

    Destination Subfolders:

    • Subfolder 105208 was already available and was used because of the ‘zero’ prefix in the ID number.
    • Subfolder 900105028 was created by our File Mover.

    RunTime Log:

    File ‘055400E000105028-DEN-20210412_12 – Copy.pdf’ was copied to ‘C:\Test\Out_Pdf\105028\’ because this already existed. The Pascal Script removed the zeros from the ID number and checked if it already was available.

    File ‘055400E900105028-DEN-20210412_12.pdf’ was copied to ‘C:\Test\Out_Pdf\900105028\’. The ID number has no ‘zero’ prefix so the complete ID number was used to create the subfolder.

    Limagito File Mover RunTime Log

    As you see many options are possible with Limagito File Mover so don’t hesitate to ask.
    If you need any help with this ‘specific filename part to specific folder’ request, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Pascal Script WIN , ,
  • 22 Apr

    Error while searching files: Invalid signature message

    Q: We have the problem with deletion rules for different SANs that the error message “Error while searching files: Invalid signature” appears in the log. I have attached a screenshot of the error message and the rule as pdf. It’s nothing complicated. The P-drive on which should be deleted in several folders is a Quantum SAN \\MyServer\production which is connected via smb in windows and the used user has RW rights. But there are also rules on the same storage that work without this error message. Do you have any idea what this could be or what the error message means? In the blog I have unfortunately found nothing about this error message.
    The customer was using our File Mover as Application and this combined with a mapped network drive (+drive letter) which he added within Windows. This is not something we prefer certainly not when using our File Mover as Service where it is absolute necessary to use our Network Drive option to map network shares.
    Since he was using our File Mover as Application we adviced him to enter the full path instead of the mapped drive letter. We received the following feedback:
    Thanks for the tip. I have been running the rules since our last mail and it seems that it really was that. With the full UNC path, the error message does not appear so far.
    Other links about this topic:
    #FileTransfer
    If you need any help with this ‘Invalid signature’ error message, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Error ,
  • 19 Apr

    Backup source file only when copy or move to destination is successful

    Q: Backup source file only when copy or move to destination is successful. At this moment we are using the Backup option to create a backup of the source file. This is working fine but it seems to create a backup before the file is copied or moved to its destination. So when the destination fails due to some reason then the file still will be available in the backup folder. This is something we don’t want. It should only create a backup when copy or move to destination is successful.

    A: Yes this is possible but you need to do this a bit differently.

    In version v2021.4.21.0 we added a new Function Option: ‘Destination Memory & Exit Cyclus on Error’ which will be used in the setup.

    In the following example we are moving pdf Files from a WIN source to a WIN Destination. Our goal is to create a backup of the source file but only when the move to the destination succeeds.

    1.We are using a WIN folder as source, but will also work with all other Source types.

    Limagito File Mover WIN as Source
    2.Be sure the Backup option is unchecked (disabled). We need a different setup for this request.
    Limagito File Mover Backup File Setup
    3. Add an extra WIN Destination as Backup (must be the last one). This second (WIN) Destination will contain the Backup of the source files.
    Limagito File Mover Backup Destination
    4. One more step is to select ‘Destination Memory & Exit Cyclus on Error’ in the function setup.
    Limagito File Mover Function Setup
    Summary, due to this new ‘Destination Memory & Exit Cyclus on Error’ option:
    • when the first Destination fails, it will exit and not copy the file to the second, aka ‘Backup’, Destination.
    • when the first Destination succeeds but a move to the second, aka ‘Backup’, destination fails:
      • It remembers the move to the first Destination which was succesful and will not move the same source file to this first Destination during the next scan.
      • When the second Destination is available again, it will move the source file to this Destination only.
    #FileTransfer
    If you need any help with this ‘Backup source file only when copy or move to destination is successful’ request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Backup
1 2
SEARCH