SLiMSuite REST Server

EdwardsLab Homepage
EdwardsLab Blog
SLiMSuite Blog
REST Pages
REST Status
REST Tools
REST Alias Data
REST Sitemap

file_monster V2.2

Goes through directories etc and collects information on files etc.

Module: file_monster
Description: Goes through directories etc and collects information on files etc.
Version: 2.2
Last Edit: 05/12/13

Copyright © 2006 Richard J. Edwards - See source code for GNU License Notice

Imported modules: rje rje_db rje_obj rje_zen

See SLiMSuite Blog for further documentation. See rje for general commands.


<1> File Monster: [scavenge=T, organise=X and/or cleanup=T]
Goes through directories etc and collects information on files etc. "scavenge=T" will output a file containing
relevant file names and locations, ages and sizes. "monster=T" will compare for identical files and farm them off
into another directory for possible deletion.

<2> DirSum: [dirsum=T]
Goes through directories and subdirectories and summarises the number of files and subdirectories they contain. If a
directory contains less than X subdirectories [dircut=X] then the subdirectories of that directory will also be
summarised. Output is in the form: PATH,files,subdir

<3> Rename: [rename=T]
Renames all the chosen files [filelist] with the given prefix [prefix=X] into outdir. If usedate=T, dates will be
added to the prefix (e.g. outdir/prefixdate_num) otherwise new names are just outdir/prefix_num.

<4> Fix line endings [fixendings=LIST]
Replace Mac \\r with \\n line endings in place with option to backup old file (unless backups=F).


File = File (or directory) name (no path)
Parent = Parent directory from DirList
Folder = Path containing file (or directory)
Type = File extension (or "DIR")
Size = Size in bytes
Date = Age converted to human readable string
Age = Age of file (MTime) in seconds
CTime = String representation of Creation Time
MTime = String representation of Modified Time
ATime = String representation of ATime
FilePath = Full path to file

General Commandline

filelist=X,Y,..,Z : List of files of interest. Can have wildcards. [*]
dirlist=LIST : List of directories to look in, in order of preference good -> bad for duplicates. [./]
subfolders=T/F : Whether to look in subfolders [True]
stripnum=T/F : Whether files may have -XXX numerical suffix from renaming, which should be stripped [False]

File Monster Commandline

oldmonster=T/F : Whether to run old File Monster (V1.x). Will be retired once update complete. [False]
outdir=PATH : Output directory for renamed/reorganised files [./Organised/]
dumpdir=PATH : Directory in which to dump redundant files (don't move if "None") [./Redundant/]
cleanup=T/F : Whether to delete empty directories (and move/delete stripnum) [False]
cleanfiles=LIST : List of hidden files to delete during cleanup if directory seems empty ['.picasa.ini','.DS_Store']
sizematch=X : Size % similarity threshold to count as match [99.9]
skiplist=LIST : List of filenames to skip [thumbs.db]
organise=X : File reorganisation mode (none/date/month/compile) [None]
orgprefix=X : Prefix for organised outdir subdirectories ['']
redundancy=T/F : Whether to check/rate redundancy for scavenge etc. [True]
scavenge=T/F : Whether to perform collation of file information [False]
searchid=X : ID for search - allows multiple searches to be compared easily [None]

DirSum Commandline

dirsum=T/F : Whether to perform summary of directory contents [False]
dircut=X : Max number of subdirectories to have and still delve into them [50]
dirdepth=X : Max depth of subdirectories to delve into. Negative = all. [-1]
extlist=LIST : List of file extenstions to report individual stats for ['']

LineEndings Commandline

fixendings=FILELIST : Replace Mac with UNIX line endings for FILELIST (wildcards allowed) []


File Monster Commandline

monster=T/F : Whether to perform monster cleanup of redundant files [False]
gooddir=LIST : List of "good" directories to be automatically kept if i<1 (including subdirs) []
baddir=LIST : List of "bad" directories to be automatically screened if i<1 (including subdirs) []
keepnew=T/F : Preferentially keep newer files of same size if good/bad status equal [True]
purgelist=LIST : List of filenames (allowing wildcards) to purge (move/delete) [WS_FTP.LOG]

Rename Commandline

rename=T/F : Whether to rename files [False]
sortby=X : Whether to sort by date or name [date]
prefix=X : Text prefix for new file names []
usedate=T/F : Whether to use date in new name [False]

History Module Version History

    # 0.0 - Initial Compilation.
    # 1.0 - Initial Working version
    # 1.1 - Broadened away from strict extension-based scavenging to whole file names with wildcards
    # 1.2 - Added DirSum function and updated FileMonster slightly.
    # 1.3 - Added redundant file cleanup
    # 1.4 - Added skiplist and purgelist
    # 1.5 - Added rename function (to replace Perl module)
    # 1.6 - Minor bug fix.
    # 2.0 - Major reworking with new object making use of rje_db tables etc. Old functions to be ported with time.
    # 2.1 - Added dirsum function.
    # 2.2 - Added fixendings=FILELIST to convert Mac \\r into UNIX \\n

© 2015 RJ Edwards. Contact: