Folder clean up and unrar scripts v1.0

These scripts are tested but not guaranteed, they are still being tweaked.

If you would like to try them please test against temp folders first. Feedback is welcomed.

Description

These scrips perform some clean up tasks. Some of these have been written before by others as buttons. Using the new script support should mean that caching of selected files should mean less erroneous changes.

Functionality


CleanListFolder
Makes some assumptions about what to do based on this being a list folder.
A list folder is a folder that contains other items but is not an item. E.G a Movies folder would be a list folder. A movie folder would be an item folder.

  • Runs FilesToFolders on all child files, excluding special files (see CleanListFolder_FilesToIgnore in config) like thumbs.db.
  • Runs CleanItemFolder on each child folder.

CleanItemFolder
Makes some assumptions about what to do based on this being an item folder.

  • Collapses certain files (see CleanItemFolder_FoldersToCollapse in config) like cd1 cd2.
  • Runs unrar on all rar files, removing the original file.

CollapseFolder
Move contents of folder to parent, optionally removing folder
c:\a\b.txt --> c:\b.txt

FilesToFolders
Move each file to a folder of the same name excluding extension
c:\a.txt --> c:\a\a.txt

unrar
Unrar given file, optionally remove files if unrar was successful. Requires unrar.exe

Clean Folders menu:

Clean Folder script add-in:

v1.0 (latest):

  • Clean Folder.js.txt (34.8 KB)
  • Download and drag the file to the list under Preferences / Toolbars / Scripts.

v0.2 (older):

Button to toggle debug output when the other buttons run (toggles the $glob:debug global variable):

  • set debug.dcf (546 Bytes)
    @toggle:if $glob:debug
    
    @ifset:$glob:debug
     @set $glob:debug
     Set UTILITY=Off
    @ifset:else
     @set $glob:debug=true
     Set UTILITY=OtherLog,On
    

I'm working my way back into the scripting world, hoping to try to extend the limited functionality that several people wrote for me last spring. I realized that while I looked at your script last spring, I never dove deep enough into it to truly understand what it was designed to do or how it would actually function. So, I'm wondering if you've done any further development on this script or if you can help me understand how it works. My goal is to use something like this to clean junk out of my \Music folder as I work on renaming and moving music files.

I have updated the script to 1.0. There are many improvements and bug fixes.
Of note this version displays a progress bar as the Clean up List is running.

@MSWallack have you had a chance to look over the script? That would be the best palace to start. If you have any specific questions or get stuck let me know.