====== Delete Files ====== New for Synchronet v3.19, this JavaScript utility script replaces the functionality of the old [[util:DELFILES]] program. It can be used to: * Delete files that were uploaded/imported more than //n// days ago (max age configured in [[util:SCFG]]) * Delete files that have not been downloaded in more than //n// days (purge by last download date configured in [[util:SCFG]]) * Delete the oldest files that cause the number of files in the directory to exceed the configured maximum (configured in [[util:SCFG]]) * Remove files that are not physically present on the disk (so-called "offline" files) ===== Invoke ====== Run with [[util:JSexec]] jsexec delfiles -help usage: [-options] [[dir_code] [...]] options: -lib= search for duplicates in specified library only -ex= add to excluded file name list (case-insensitive) -offline remove files that are offline (don't exist on disk) -test don't actually remove files, just report findings If no options or directories are specified, all directories will be scanned for files that should be removed/deleted based on the sysop's configuration of the directories (i.e. maximum file age and maximum number of files to retain). ==== Examples ==== * To search all directories for files to be removed based on age or excess number of files: jsexec delfiles * To search only directories in the "Main" library for offline files to be removed: jsexec delfiles -offline -lib=Main * To report files that *would* be removed/deleted from the "games" directory, without actually removing or deleting them: jsexec delfiles -test games ===== See Also ===== * [[:module:|module index]] {{tag>jsutil files}}