File Mover Blog

  • 08 Sep

    How to use a wildcard in the excel sheet name

    Q: How to use a wildcard in the excel sheet name. I am using the below to split and convert the tabs out of a spreadsheet but every now and again the client gets the sheet name slightly wrong.

    wildcard in the excel sheet name

    Can you use a wildcard in the sheet name option?

    Example:

    2 Sticker*

    A: Added on request and available in v2023.8.12.0

    Example where we used: Page*

    wildcard in the excel sheet name

    If you need any info about this ‘wildcard in the excel sheet name’ request, please let us know.

    #excel #filetransfer #filemanagement

    Best regards,

    Limagito Team

    By Limagito-Team XLS/CSV , , ,
  • 08 Sep

    Query around filename to directory name

    Q: Query around filename to directory name. Reaching out just in case you have an easy way to assist for this one:

    We have a rule which currently picks up files from a SFTP source and drops them into an S3 bucket.

    Here are a sample of the source filenames:

    • (64506930) 87268700 20230826.pdf
    • (64506930) 87268701 20230826.pdf
    • (568454) 87282612 20230831.pdf

    This works, however we would like to drop them into a folder based on the {accountId} which is between the brackets:

    filename to directory name

    However we can’t rely on the filename begin and end positions as the accountId isn’t always the same length.

    Is there an easy answer to use a regex or something to select the accountId from between the brackets?
    Please let me know if you have any queries.

    A: In your Destination setup please adjust the ‘Create Subdir option’ to:   %SFN

    limagito file mover destination subdirectory option

    • Enable ‘Rename Destination Subdirectory’ and open ‘Rename Filter Setup’

    limagito file mover rename directory option

    • Directory Renaming Setup:
      RegEx:  \((.*)\)(.*)
      Replacements:   user/\1/invoices/

    filename to directory name

    • RunTime Log Result:

    limagito file mover runtime log result

    • Feedback Customer:

    Just a quick email to say thank you!  I only reach out to support occasionally – and each time I’m surprised at the level of support provided.

    If you need any info about this ‘filename to directory name’ request, please let us know.

    #mft #filetransfer #filemanagement

    Best regards,

    Limagito Team

    By Limagito-Team Rename
  • 30 Aug

    How to count the number of files transferred to destination

    Q: I have another question we have big differences as far as the number of images some of our agencies sending us and the destination vendor receiving. They are asking if Limagito can count the number of files transferred to destination.

    A: In this blog article we added some scripts to count the files sent to a Destination. Transferred files counter data will be written to a monthly csv file. Each scan will be an entry in the csv file (which can be handled in Excel). This is just an example and can be adjusted to your needs.

    • Open our Pascal Script option:

    limagito file mover pascal script option

    • Enable and add the following ‘On Rule Begin’ script:
      • psVIA: an Integer variable which will count the amount of files transferred during the scan
      • psVSA: a String variable which will be used as the filename of the counter csv ( i.e. 2023.august.csv )
      • psVSB: a String variable which will be used for the Date entry in the csv file ( first column )
    Begin
      psExitCode:= 1;
      // ... add your code here
      psVIA := 0;
      // Current Month counter csv filename -psVSA
      psVSA := FormatDateTime('YYYY.MMMM', Now) + '.csv';
      // Current Day - psVSB
      psVSB := FormatDateTime('YYYYMMDDHHNNSS', Now);
    End.
    

    limagito file mover on rule begin pascal script

    • Enable and add the following ‘On Rule End’ script. Don’t forget to adjust the ctCsvPath constant. This is where we will store the csv files.
    Var
      tmpData, tmpFile: String;
      tmpSuccess: Boolean;
      tmpList: TStringList;
    Const
      ctCsvPath = 'C:\Test\Csv\'; // Must end with a \
    Begin
      psExitCode:= 1;
      // Check if files were moved or copied
      If psVIA = 0 Then
        Exit;
      // Init Var
      tmpData := psVSB + ',' + IntToStr(psVIA);
      tmpFile := ctCsvPath + psVSA;
      tmpSuccess := True;
      tmpList := TStringList.Create;
      Try
        If FileExists(tmpFile) Then
        Begin
          Try
            tmpList.LoadFromFile(tmpFile);
          Except
            tmpSuccess := False;
            psLogWrite(1, '', 'LoadFromFile, ' + tmpFile + ' error, counter data will not be saved: ' + tmpData);
          End;
        End
        Else
          tmpList.Add('Date,Value');
        // Check
        If tmpSuccess Then
        Begin
          tmpList.Add(tmpData);
          // Save To File
          Try
            tmpList.SaveToFile(tmpFile);
            psLogWrite(1, '', 'SaveToFile ' + tmpFile + ' successful');
          Except
            psLogWrite(1, '', 'SaveToFile ' + tmpFile + ' error, could not save counter data: ' + tmpData);
          End;
        End;
      Finally
        tmpList.Free;
      End;
    End.
    

    limagito file mover on rule end pascal script

    • Set Function Destination Option to ‘Exit Cyclus on Error’. This will skip a next Destination if an error occurs. The last Destination will be a Script where we increase the amount of files transferred so we want to make sure that the previous Destination(s) were successful.

    limagito file mover function setup

    • The last Destination should be the following Pascal Script:

    limagito file mover destination setup

    Begin
      psExitCode:= 1;
      // ... add your code here
      psVIA := psVIA + 1;
    End.
    

    limagito file mover pascal script as destination

    • Counter values will be stored in a monthly csv file which can be handled in Excel (or alternative):

    limagito file mover count files transferred to destination

    limagito file mover count files transferred to destination

     

    If you need any info about this ‘count the number of files transferred’ request, please let us know.

    #mft #filetransfer #filemanagement

    Best regards,

    Limagito Team

1 16 17 18 19 20 21 22 135
SEARCH