delete

  • 01 Aug

    How to delete Folders based on the name of the folder

    Q: How to delete Folders based on the name of the folder.

    The schema is:

    username_YYMMDD-HHMMSS

    is it possible to extract the date and use it as condition to check if it is older than x days and than delete the folder and all of its content?

    limagito file mover delete Folders based on the name

    A: Yes, this is possible using some Pascal Script.

    • Source should be a Windows Folder or Share. We used the following folder as Source:

    limagito file mover windows folder as source

    Or test content looks like:

    limagito file mover Delete Folders based on date in Folder Name

    • Pascal Script Setup

    limagito file mover pascal script option

    • Enable ‘On Rule Begin’ Pascal Script option and copy/paste the script from here: link
      • Do not forget the adjust the ctOlderThanDay Const value. We used 500 days.
      • The Date format we used was YYMMDD

    limagito file mover pascal script setup

    • File Filter Setup

    limagito file mover file filter setup

    • Directory Setup

    limagito file mover directory setup

    • The %VSA (= Var String A) is used as directory filter. The previous Pascal Script will add the Subfolders to delete (older than x days) into this var.

    limagito directory setup

    • Function Setup

    limagito file mover function setup

    • RunTime Log Result:

    limagito filemover runtime log result

    • Source Content Result:

    limagito filemover delete Folders based on the name

    If you need any help with this ‘delete Folders based on the name’ request, please let us know.

    Best Regards,

    Limagito Team

    #managedfiletransfer #filetransfer #filemanagement

  • 28 May

    Delete all contents of a destination folder before files are moved

    Q: Is there a way to delete all contents of a destination folder before files are moved/not just overwriting them? I am unzipping a large folder with files daily, most files are named the same thing so they can overwrite them. Have a few that are named with dates and times so they just end up staying in the folder.

    A: If the unzip folder is always the same, the following solution could help you. We added a script that will delete all files and subfolders when ‘On Rule Begin’ is triggered. The path you need to use in the script is the one you will use in your UNZIP as Destination setup.

    – Open Pascal Script Setup

    limagito file mover pascal script

    • Enable and Add the following ‘On Rule Begin’ Pascal Script. In this example our Unzip path = C:\Test\Out\UNZIP\

    Don’t forget to adjust the ctOutputPath const, must end with a \

    Const
      ctOutputPath = 'C:\Test\Out\UNZIP\';
    Begin
      psExitCode:= 1;
      // ... add your code here
      psLogWrite(1, '', 'Delete Tree: ' + ctOutputPath);
      psDeleteFiles(ctOutputPath, '*.*');
      psDeleteTree(ctOutputPath, True);
    End.

    Delete all contents of a destination

    #filetransfer #mft #filemanagement

    If you need any info  about this ‘Delete all contents of a destination’ request, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script WIN ZIP ,
  • 30 May

    Q&A 13: is it possible to retry a file delete if it fails in LimagitoX File Mover

    Q: Is it possible to automatically retry a file delete if it fails

    A: Yes this is possible since version v2020.5.30.0

    Select ‘Function Setup’ >> Common Tab

    Here you’ll find ‘Retries after failure’ and ‘Seconds between each retry’. In the screenshot below we’ll try 3 times and will wait 5 seconds between each retry.

    LimagitoX Retry File Delete option

    As long as the source file is locked it will retry. If it is unlocked within the retries it will not give an error.

    LimagitoX File Delete Retry RunTime Log succes

    If the file is still locked after all the retries then it will give an error + information why it couldn’t delete the file.

    LimagitoX File Delete Retry RunTime Log error

    In version v2020.6.1.0 we added the ‘On Error Event & On Error Execute Command’ if a Delete after Move fails.

    If you need help with the ‘retry a file delete’, please let us know.

    Regards,

    Limagito Team

    By Limagito-Team Q&A , ,
1 2 3
SEARCH