watchDirectory Help > Plugins > Remove Oldest Files
Automatically Move or Remove the Oldest Files from Directories
Use this plugin to automatically maintain directories - keep only the "youngest" files. Perfect to auto-cleanup directories with log-files. Each time WatchDirectory detects a new or changed file, this plugin will scan the directory of the new file and makes sure only the youngest XX files remain.
Settings for this plugin
How many files should remain inside the directory
Enter the maximum number (1 - 1000) of files you want to remain in the directory. When there are more files present, this task will delete or move the oldest.
Only count and remove files with those extensions
If the directory has a mix of files (for example, it contains ZIP files and LOG files), but you only want this task to count and remove LOG files, you can enter
the file extension(s) here. If you leave this empty, the task will consider all files.
Move oldest files to this directory
Leave this option unchecked if you want the old files to be deleted.
How the Age of files is calculated
To determine which file is the oldest, this task looks at 2 timestamps maintained for this file:
Creation Date: When the file was originally created
Last Modified Date: When the file was last changed
Typically, the Last Modified date is used to determine how old the file is. In some cases, the Creation Date is "newer" (younger) and that is used instead.