Order in my Folder is based on an original idea by Elliot Morshead, he needed a solution to do a schedule order in a logging system that was creating a huge amount of files based on intensive transactions system.
The entire log files where created inside the same folder and he was looking for a solution to reorder those log files into sub folders.
This is why the first version of OIMF was a command line only version so it can be executed from a batch or a script as a scheduled task.
After this first release a lot of people asked me for a GUI version, so I wrote it, and then with a few more suggestions by Elliot we created version 1.3.
This version has two executable files, a command line version and a GUI version.
The two versions are based on the same core code with almost identical features.
When OIMF is executed, it first checks to see if it appears in the registry context menu section, if not it will write its location in the registry, if it appears in the registry, it will check to see if the registry value is pointing to the current OIMF location (folder).
OIMF can be executed directly from the context menu (right click on a folder), so this check is important to keep OIMF portability and still let you execute it from the context menu, because when you use it from the context menu, the registry is passing the OIMF executable location and parameters to the shell for execution.
The second check is to know if OIMF was executed from the context menu or not, if it was executed from the context menu we need to open OIMF directly in the selected folder.
At this point, the user needs to enter or select the different sorting parameters:
- Target folder
- Files mask
- Sorting type
- Apply to all files or just for files older than x days
Now we need to process the different parameters entered by the user (GUI or command line), this is done by creating an "Order" object and applying the different parameters as properties of this object so it becomes the sorting rules.
After that, we are ready to process the files, when the user clicks on "Order", OIMF is scanning the target folder, counting the files and each file is compered against the sorting rules.
If the file is compatible with the files mask (*.something) and the file age is compatible with older than… , we can process the file, if not we are moving to the next file.
When a file is compatible with the mask and age, we start the process:
If files are sorted by any of the dates sorting types, we first retrieve the file date, and now we are doing the proper manipulations on this date, if for example we sort the files by date, we need to change the date format xx\xx\xxxx into xx-xx-xxxx, because xx\xx\xxxx is illegal as a folder name.
Now we check if folder xx-xx-xxxx already exists, if it is, we will move the processed file into this folder, if it doesn't exists OIMF will create this folder and then move the processed file into this folder, and continue with the next file.
OIMF can sort files by creation dates or by modified dates.
If we select to sort the files by filename extension, then we extract only the file name extension of the file, check if a folder with this name exists (if not create it) and move the file to this folder and move on to the next file.
If the file has no extension then it will be moved into a folder named "NoExt".
So basically each file inside the target folder is compered against the sorting rules and handled according to this rules.
OIMF is a portable application (after you extract it from the install package), which means you can run it from a USB drive or from a different computer without installation.
OIMF was compressed with UPX to achieve a small file size.