subfolders

  • 27 Jan

    Move data to Dropbox project folder based on filename information

    Q: Move data to Dropbox project folder based on filename information

    Objective: Move data from server to Dropbox project folder based on filename information.

    Example of such a filename: P9876543210_122123_EI0001_BIA1234C.zip

    The Project Number is the first part until the underscore > P9876543210 This Project Number should be available in one of the Dropbox subfolders, so you’ll need to scan the subfolders of the Dropbox as Destination Root folder. There may be cases where the Project Number cannot be found in the Dropbox. This could be due to a typo or incorrect formatting by the scientist when setting up the experiment. In this case the .zip should be moved to the Dropbox …\Clients\Unknown\ directory.

    A: We added a new option in version v2024.1.20.0 to achieve this.

    • We used a Windows folder as Source. In this folder we’re going to search for the project zip files.

    limagito file mover windows folder as source

    • Added the following include filename filter because we are only interested in .zip files:

    limagito file mover filename filter setup

    • Next, please open our Pascal Script option:

    limagito file mover pascal script option

    • Enable and Add the following ‘On Destination’ Pascal Script:
      • Please add the following script: link
      • This script will:
        • strip the project number from the filename into variable %VSA
          • P9876543210_122123_EI0001_BIA1234C.zip > P9876543210 > %VSA
        • remove the project number from the filename into variable %VSB
          • P9876543210_122123_EI0001_BIA1234C.zip > 122123_EI0001_BIA1234C.zip > %VSB
        • Both variables will be used in the Dropbox as Destination setup

    Move data to Dropbox project folder based on filename information

    • We added our Dropbox as Destination option and adjusted the Directory option > ‘/Clients’:

    limagito file mover dropbox as destination

    • Dropbox OAuth2 setup:
      • Enable ‘Send Code Challange’
      • Enable ‘Include Nonce’
      • Authorization Endpoint URL: https://www.dropbox.com/oauth2/authorize
      • Token Endpoint URL: https://api.dropboxapi.com/oauth2/token
      • Add your Client ID and Client Secret (= App Secret)
      • As scope we used:
        • files.metadata.read files.metadata.write files.content.read files.content.write
      • Type was set to:
        • code
      • Do not forget to set the Redirect URI (must be exact)
        • http://localhost:3017/
    • Click <GET> and follow the procedure. Afterwards Refresh and Access Token will be automatically added.

    limagito file mover oauth2 setup

    • Now the important part. We added our new ‘Search for Subdir Options’ under the ‘File & Directory’ Tab. So in our setup we will be looking for a subdirectory through all existing subfolders of the Dropbox Destination Directory with the name ‘%VSA/Data’ which converts using our example filename to ‘P9876543210/Data’. The variable %VSA is determined by the previous Pascal Script. The reason we added the /Data part is because the customer requested to store the files within a Data subfolder of the corresponding Project directory.
    • If we don’t find this subdirectory then Clients/Unknown will be used. This ‘Search and replace Directory default full path’ must be a full path meaning starting from the home folder.

    limagito fil emover search for subdir option

    • We also added file renaming because the customer wanted to strip the Project number from the original Source filename.
      • The complete filename will be replaces with the content of variable %VSB

    limagito file mover dropbox file rename setup

    #dropbox #managedfiletransfer #filetransfer #filemanagement

    If you need any help with this ‘Dropbox project folder’ request, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Dropbox ,
  • 01 Nov

    Create subfolders ahead with Limagito File Mover

    Q: We’re trying to create subfolders ahead with a rule in a following format: 2021\11 Nov21
    Is it possible to do this with an empty rule eg there’s no source file to move/copy? What would be the best way to handle this? Many thanks

    A: This is possible using our ‘Pascal Script’ as Source option. In this case no source files are needed.

    First add ‘Pascal Script’ as Source:

    Limagito File Mover Pascal Script as Source

    Add the following Pascal Script code.  Do not forget to adjust the ctPath const, end with a \

    Var
      tmpSubPath: String;
    Const
      ctPath = 'C:\Test\Out_PSC\';
    Begin
      psExitCode:= 1;
      // Create subfolders in the following format: 2021\11 Nov21
      tmpSubPath := FormatDateTime('YYYY\DD MMMYY', Now);
      If ForceDirectories(ctPath + tmpSubPath) then
        psLogWrite(1, '', 'Create Directory: ' + ctPath + tmpSubPath + ', Successful')
      Else
        psLogWrite(1, '', 'Create Directory: ' + ctPath + tmpSubPath + ', Error')
    End.

    Limagito File Mover Pascal Script Code example

    This script will create a single subfolder when it is triggered using the current date. Of course it can be modified so it fits your needs,  just let us know.

    Limagito File Mover RunTime Log

    Update, received the following question from user: Is there a way to add +1 to either month or date so I can adjust as required?

    1) To add a day, replace:  tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, Now);
    by
    tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, psIncDay(Now, 1));
    2) To add a month, replace: tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, Now);
    by
    tmpSubPath := FormatDateTime(‘YYYY\DD MMMYY’, psIncMonth(Now, 1));

     

    #FileTransfer

    If you need any info about this ‘create subfolders ahead’ question, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script ,
  • 04 Apr

    Exclude some subfolders and the subfolders of the excluded subfolder

    Q: Exclude subfolders and the subfolders of the excluded subfolder. I’m connecting to a FTP site, looking through the folders for any files older than 28 days but I want to exclude some sub-folders and the sub-folders of the excluded folder.

    My current ‘Directory Filter’ setup doesn’t seem to work:

    Limagito File Mover Directory Filter Setup

    My current ‘Dir Name’ Exclude filter:

    Limagito File Mover Directory name exclude filter

    I also changed the Directory Filter Setup – Advanced – Exclude Complete Invalid SubDirs hoping it would skip the sub folders of the GRAPHICS PURGE folder.

    Limagito Team: “Reason, SubDir Search Mode (WIN) is for WIN as source only”

    Limagito File Mover Directory Filter setup

    But in the log file we see the ‘GRAPHICS PURGE’ folder and its subfolder BUL are not being excluded.

     

    Limagito Team:

    It is possible to achieve this but you’ll need to add some extra ‘Dir Name Exclude’ Filters, leave the ones you already had.

    GRAPHICS PURGE
    */GRAPHICS PURGE/*
    Ads
    */Ads/*
    PDF
    */PDF/*

    Limagito File Mover Directory name exclude filter setup

    #FileTransfer

    If you need any help with this ‘Exclude some subfolders’ request, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Filters ,
SEARCH