The script below moves files to corresponding folders based on their extensions:
-------------------------------------------------------------------------------------------
Compressed
zip rar r0* r1* arj gz sit sitx sea ace bz2 7z
Documents
doc pdf ppt pps docx pptx
Music
mp3 wav wma mpa ram ra aac aif m4a
Programs
exe msi
Video
avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg mkv
-------------------------------------------------------------------------------------------
What it really does:
1. Create five subfolders named "Documents", "Programs", "Compressed", "Music", and "Video" in the current folder.
2. Move the files in the current folder to one of the five subfolders above.
Notes:
1. The way of categorizing files is from the Internet Download Manager (IDM).
2. To avoid accidental operation, the path to be tidied up should be explicitly declared at the beginning of the script, one line per path.
For example, "C:\Users\UserName\Downloads".
3. The tags will also be moved (if there is any).
4. If there are already subfolders named "Documents", "Programs", etc. in the current folder then they will be used directly.
5. The way of categorization as well as the types of files to be categorized can be customized by modifying the script.
Screenshot (created with ScreenToGif):
Code: Select all
$AllowedPaths = <<<PathsAllowedToBeTidiedUp
//Replace this line with the paths you would like to tidy up (one line per path)
PathsAllowedToBeTidiedUp;
$tk_index = gettokenindex("<curpath>", $AllowedPaths, "<crlf>", "c");
if($tk_index)
{
$CurrentContents = listfolder(2:="1", 3:="<crlf>");
if (!quicksearch("Documents /nd", 3:="n"))
{new("Documents", "dir");}
if (!quicksearch("Programs /nd", 3:="n"))
{new("Programs", "dir");}
if (!quicksearch("Compressed /nd", 3:="n"))
{new("Compressed", "dir");}
if (!quicksearch("Music /nd", 3:="n"))
{new("Music", "dir");}
if (!quicksearch("Video /nd", 3:="n"))
{new("Video", "dir");}
$Documents = regexmatches($CurrentContents, "^.*\.(doc|docx|pdf|ppt|pps|pptx)$");
$Programs = regexmatches($CurrentContents, "^.*\.(exe|msi)$");
$Compressed = regexmatches($CurrentContents, "^.*\.(zip|rar|r\d{1,2}|arj|gz|sit|sitx|sea|ace|bz2|7z)$");
$Music = regexmatches($CurrentContents, "^.*\.(mp3|wav|wma|mpa|ram|ra|aac|aif|m4a)$");
$Video = regexmatches($CurrentContents, "^.*\.(avi|mpg|mpe|mpeg|asf|wmv|mov|qt|rm|mp4|flv|m4v|webm|ogv|ogg|mkv)$");
if($Documents) {moveto("<curpath>\Documents", "$Documents" ,5:="-1");}
if($Programs) {moveto("<curpath>\Programs", "$Programs" ,5:="-1");}
if($Compressed) {moveto("<curpath>\Compressed", "$Compressed" ,5:="-1");}
if($Music) {moveto("<curpath>\Music", "$Music" ,5:="-1");}
if($Video) {moveto("<curpath>\Video", "$Video" ,5:="-1");}
status "Completed" , 2:="ready"
}
else
{status "Current path is not allowed to be tidied up", "8B4513", "stop"; end true;}