File Mover Blog

August 1, 2025

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

By Limagito-Team Delete Filters Pascal Script , Share:
SEARCH