Sort Any Folder v1.21
#1
Posted 01 May 2011 - 10:33 AM
version 1.2.1.0
System Requirements:
Windows XP, Vista, 7 and above (32 or 64-bit)
Download latest version:
Sort Any Folder.ahk (must compile EXE to use right-click context menu function)
Sort Any Folder.exe (recommended, works with right-click context menu)
Description:
Creates subfolders in selected folder and sorts files into them.
User is then given choices to move sorted documents, pictures and music
into User's regular Documents, Pictures and Music folders
(Uses My Documents, My Pictures and My Music folders in XP).
Subfolders created in User-selected folder (only if file extensions exist):
Unsorted AHK Scripts
Unsorted Documents
Unsorted EXE Files
Unsorted Music
Unsorted PDF Files
Unsorted Pictures
Unsorted Video
Unsorted Zip Files
Version History:
v1.0.0.0 - got the idea from here (thanks guys!): Sorting my downloaded files
v1.1.0.0 - improved range of file types that are recognized and sorted
v1.2.0.0 - implemented "Loop, Parse" to optimize looking for file extensions
v1.2.1.0 - added "Sort This Folder" context menu option (thanks newbie123)
#2
polyester
Posted 01 May 2011 - 12:35 PM
#3
Posted 01 May 2011 - 01:25 PM
Now it would be great if files could be sorted into subfolders by their content & relevance, and then these subfolders could be labeled accordingly. :lol:
Content and relevance as in what text is in the files, or what? Haha
#4
Posted 01 May 2011 - 01:49 PM
I'm not sure how it could be done, something like this maybe:
IfExist,
{
*.wav
*.mp3
*.mid
*.wma
}
FileCreateDir, MusicSomething like that would search out the listed file extensions and only create the folder "Music" if one or more of the file extensions appear in the target folder. Anyone have a solution for that?
#5
Posted 01 May 2011 - 02:02 PM
<!-- m -->http://www.autohotke...s/LoopParse.htm<!-- m -->
#6
Posted 01 May 2011 - 02:11 PM
This would prevent creation of empty folders, AND it would prevent having to use
IfExist, *.??? FileCreateDir, *FolderName*for each and every single file extension name. That would be much larger, there has to be a better way. I'm not sure I understand LoopParse at all lol!
#7
Posted 01 May 2011 - 03:02 PM
MsgBox % MultiExist("*.wav|*.ico")
MultiExist(patterns){
Loop PARSE, Patterns,|
If FileExist(A_LoopField)
Return true
return false
}untestedor just multiple FileExists with the or operator
#8
Posted 01 May 2011 - 06:18 PM
Loop, %Dir%
{
if A_LoopFileExt in bmp,jpg,png
Do Something
}We need [Pseudo Code] Tags :-)
#9
Posted 02 May 2011 - 09:29 PM
*note* I could not get the LoopParse thing happening, I only encountered strange errors, so I chose reliability instead of taking chances.
Creates subfolders in selected folder and sorts files into them ONLY if those file extension names are found.
User is then given choices to move newly sorted documents, pictures and music
into User's regular Documents, Pictures and Music folders
(Uses My Documents, My Pictures and My Music folders in XP).
Subfolders now created in User-selected folder (if files exist):
Unsorted AHK Scripts
Unsorted Documents
Unsorted EXE Files
Unsorted Music
Unsorted PDF Files
Unsorted Pictures
Unsorted Video
Unsorted Zip Files
You can copy/paste the new script from the first post in this thread.
#10
Posted 03 May 2011 - 11:46 AM
UPDATED to v1.1 in first post, with some changes:
*note* I could not get the LoopParse thing happening, I only encountered strange errors, so I chose reliability instead of taking chances.
Loop, FilePattern
not
Loop, Parse
It would simplify your script greatly.
#11
Posted 03 May 2011 - 03:48 PM
#12
Posted 03 May 2011 - 03:59 PM
Instead of:
FileMove, *.ahk, Unsorted AHK Scripts, 0 ; AutoHotkey Script Files FileMove, *.ahk.bak, Unsorted AHK Scripts, 0 ; AutoHotkey Script Files FileMove, *.bak, Unsorted AHK Scripts, 0 ; AutoHotkey Script Files FileMove, *.pdf, Unsorted PDF Files, 0 ; Adobe PDF Files
You can do:
FileTypes := "ahk,ahk.bak,bak,pdf" Loop, Parse, FileTypes, `, ; Parse using comma as a delimiter FileMove, *.%A_LoopField%, Undosrted %A_LoopField% scripts, 0
Of course it's more helpful the longer the loop-list is. I think the time I was helped I wanted to "fade in" a Splashscreen, and had a long series of "WinSet, Transparency, 30" increasing and decreasing. The one who helped me changed that to parsing a string with "30|50|70|90|100|110|100|95|75|50|30|15" instead, simplifying the script a lot. I didn't understand what was going on... Thread
#13
Posted 03 May 2011 - 08:26 PM
I figured out "Loop, Parse", thank you much for all your help, guys!
Updated script is in the first post on the thread
Thanks again!
#14
Posted 03 May 2011 - 09:07 PM
#15
Posted 03 May 2011 - 09:35 PM
Morpheus: he means Loop Parse to get multiple filepatterns, as in my example. Loop Filepattern is usesless for say, both .exe and .ico
I was thinking that if I were doing it, I would use this code as I have posted above.
Loop, %Dir%
{
if A_LoopFileExt in bmp,jpg,png
Do Something
}So not useless, but definitely different. I can see the advantage of mass moving files by extension, as opposed to one at a time as my method would require.
You could also use Glob by Lexikos and then parse that list, but it doesn't seem worth while to me.




