Tuesday, March 20, 2012

Order in my Folder 1.3


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.



4 comments:

  1. Wow, this is what I was looking for exactly on sorting some of my log files. Though think I found a slight bug in it.
    On the command-line version, since batch files save time. If I have a log in a sorted folder and another outside of it with the same name. It overwrites one of them. Maybe an option to rename files with the same name would be nice to have.

    ReplyDelete
  2. Hi,

    Thank you for trying my software, this one is really a unique tool, the credit for the idea goes to Elliot Morshead.
    I have received some requests to add this feature, it will be add to the next version when I will find the time to work on it.
    I hope it will be soon.

    Zvika

    ReplyDelete
  3. Hi I loaded this program on my work pc and it works perfectly. On my home pc it crashes, is it because my home pc is 64bit? Both are windows 7 dave.raw@smhgroup.co.za

    ReplyDelete
  4. Hi Dave,

    OIMF works fine on 32 and 64 bit OS, I think there is a conflict on your PC, I would stop some of the extra stuff running on your machine (Antivirus, Skype, etc) and see if it crashes again, can you send the error message to my mail ?

    Z.

    ReplyDelete