DonationCoder.com Forum

DonationCoder.com Software => Older DC Contests and Challenges => N.A.N.Y. 2010 => Topic started by: pyrohacker on December 13, 2009, 08:39 PM

Title: pyrohacker
Post by: pyrohacker on December 13, 2009, 08:39 PM
NANY 2010 (https://www.donationcoder.com/forum/index.php?board=273.0) Entry Information

Application Name SubDiv
Version 1.2
Short Description Organize your changing folders
Supported OSes MS Windows (All)
Web Pages - You're looking at one.
- GitHub Repo (https://github.com/tylerwayne/subdiv)
Download Link See GitHub (https://github.com/tylerwayne/subdiv).
System Requirements
  • Windows
  • A folder
Version History
  • 1.2 - Updated format + 2 new features
  • 1.0 - First working version
Author pyrohacker (https://www.donationcoder.com/forum/index.php?action=profile)


Description

SubDiv was built to organize folders that are constantly being filled with new content, such as a 'Downloads' folder. When you are continually throwing files from the Internet into a folder on your computer, that folder becomes very disorganized (at least for me). SubDiv will take those files and put them into folders based on the day they were created.

Features
Portable - Program is drive-independent and saves settings using .ini files, so it can be placed on any computer.
Currently sorts based on the day that a file was created.

Planned Features by Priority

Possible Features (not set in stone)

Screenshots
[ You are not allowed to view attachments ] [ You are not allowed to view attachments ]

Usage

Installation
Place the .exe file into the folder you wish to have sorted.

Using the Application
Run the program! Current settings are:

Uninstallation
Delete the .exe file and the .ini file. Please note, however, that there is no way to undo sorting at this time.

Known Issues
No issues that I'm aware of, other than incompleteness!

It's difficult to test a program that is based on taking a long time. Let me know if you run across any bugs.



Since I don't know how to manage files and folders in C++, this project has been made in AHK.
Any suggestions would be warmly welcomed!
Title: Re: NANY 2010 Teaser: SubDiv
Post by: techidave on December 28, 2009, 05:46 AM
Sounds like a useful app.  Any word on a release?
Title: Re: NANY 2010 Teaser: SubDiv
Post by: supermamon on December 28, 2009, 08:06 PM
Not meant to discourage but maybe you can get some inspiration from Belvedere (http://lifehacker.com/341950/belvedere-automates-your-self+cleaning-pc)
Maybe adding options to dynamically create folders based on date, or put up some pre-defined rules like, auto-sort by extension and create folders based on the extensions and/or type. Example predefined rules would be:
*.pdf --> Goes to PDF folder
*.xls; *.doc; *.ppt --> goes to MSOffice folder
*.jpg;*.gif;*.png --> goes to Images folder

...and yes, it's great that it will be a portable app.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: pyrohacker on January 01, 2010, 12:34 AM
Phew!  I cut it a bit too close, but SubDiv has been released!  The current version is limited, but more development will follow!

All suggestions are welcome, but I probably won't be able to address most of them.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: mouser on January 01, 2010, 12:45 AM
Seems to work as advertised  :up:
Utimately would be nice to not have to copy the subdiv program into the folder you want to sort and have some more options, but it's off to a good start.
Title: Re: NANY 2010 Teaser: SubDiv
Post by: wr975 on January 04, 2010, 10:02 AM
Not meant to discourage but maybe you can get some inspiration from Belvedere (http://lifehacker.com/341950/belvedere-automates-your-self+cleaning-pc)
Maybe adding options to dynamically create folders based on date, or put up some pre-defined rules like, auto-sort by extension and create folders based on the extensions and/or type. Example predefined rules would be:
*.pdf --> Goes to PDF folder
*.xls; *.doc; *.ppt --> goes to MSOffice folder
*.jpg;*.gif;*.png --> goes to Images folder

...and yes, it's great that it will be a portable app.

You can also try this tool...

https://www.donationcoder.com/forum/index.php?topic=17828.msg159246#msg159246

Would be great if pyrohacker adds the same features in his tool. Especially the "keep .ini and .exe together" feature request was a great idea.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: doctorfrog on January 04, 2010, 03:15 PM
I was pretty tickled with how this program ripped through my cloudy downloads folder, until I realized that the way it names folders results in an out-of-chronological-order mess...

(http://i48.tinypic.com/2moe6fa.png)

It's still a nice idea for Chronic Downloader's Remorse.

Suggestions:

1. Please use a folder naming convention that 'naturally' sorts by date, ie. 2009-03-15
2. Include an 'undo' feature.
3. Include a feature that optionally recursively sorts subfolders. In other words, it reaches into every folder, digs out everything and dumps it into the root folder, deletes all empty folders, then re-sorts based on file date. Definitely will want to include an "Are you really, really, really sure?" confirmation dialog for this.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: pyrohacker on January 04, 2010, 09:31 PM
Wow, these are some great suggestions and examples!  If they all come to pass, SubDiv will be more complex and useful than I originally had in mind ... I can't wait!

My Christmas Break is over, so development is going to have to slow down, but I don't intend to stop with version 1.0!  Just wondering, what are some opinions of the icon?  It was somewhat thrown together, so it's not the best I can do.

(The .ahk code is now hosted on a RedMine project (http://redmine.dcmembers.com/projects/subdiv/files), if anyone wants to take a look at it.)
Title: Re: NANY 2010 Final Release: SubDiv
Post by: dilligaff on January 06, 2010, 11:12 AM
out-of-chronological-order mess... Just Windows default behavior - does date sorting on a character-by-character basis,and the default North American convention of mm-dd-yy means that the year gets parsed last. Suppressed/implicit leading zeroes also cause some weird behavior in the sorts, in my experience,too.
see <http://forums.cnet.com/5208-6142_102-0.html?threadID=292241> for a discussion of this problem, and M$ other sorting inconsistencies at <http://support.microsoft.com/default.aspx?scid=kb;en-us;318872>. The photo cataloging software I currently use has the option to use the date embedded in the EXIF data,or add info to the ITPC metadata.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: doctorfrog on January 06, 2010, 07:03 PM
M$

Using the format "2010_01_06" works fine for me. Actually, it's also the folder sorting technique my image organizing software employs.

The underscores seem to break up the name enough so that Windows sorts properly, and doesn't need any special date-smart x-ray vision. Those of us in the USA can deal with the communist-inspired y/m/d order. I submit it as the easiest way to go.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: Tuxman on January 08, 2010, 10:36 PM
A new suggestion: Regex based sorting. If a file matches a certain expression, put it into $folder.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: Perry Mowbray on January 12, 2010, 06:14 PM
SubDiv has just been written up on Elite Freeware (http://elitefreeware.blogspot.com/2010/01/nany-2010-entry-subdiv.html):
[ You are not allowed to view attachments ]
http://elitefreeware.blogspot.com/2010/01/nany-2010-entry-subdiv.html


Title: Re: NANY 2010 Final Release: SubDiv
Post by: pyrohacker on January 12, 2010, 08:08 PM
Thanks for letting me know, Perry!  It's good to see NANY getting some publicity.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: mouser on January 20, 2010, 05:25 PM
Mentioned here:
http://www.addictivetips.com/windows-tips/organize-files-into-folders-automatically-based-on-date-created/
Title: Re: NANY 2010 Final Release: SubDiv
Post by: pyrohacker on January 26, 2010, 09:49 PM
SubDiv V1.2 has been unleashed!

New features include a true date format that will sort itself.  Sorry for not realizing that at first.  Also, the recursing idea has been implemented, as well as an unplanned feature: Cleanup.  When SubDiv detects an empty folder, it gets deleted.

Again, a lot of this is untested, so let me know as soon as any issues pop up.  I'm trying to find a good place to manage all of the feedback.  RedMine's nice, but I'd prefer if users didn't have to register.  Any suggestions?
Title: Re: NANY 2010 Final Release: SubDiv
Post by: adi_barb on December 13, 2010, 05:58 AM
Why is SubDiv famous?

SubDiv (http://download.famouswhy.com/subdiv/) is famous because it is a simple tool that allows you to manage and organize folders content.  :Thmbsup:
Title: Re: NANY 2010 Final Release: SubDiv
Post by: scasplte2 on February 02, 2011, 02:06 PM
First off, thank you so much for this nifty program. I was wondering is there anyway to change the date SubDiv looks at to create the folders?
Specifically, I am trying to organize a bunch of files and I wrote a program to go into each subdirectory and move certain filetypes to a specified folder. However, this action seems to rewrite the Date Created metadata leaving the original Date untouched and it is this date that I would like to sort by.
Title: Re: NANY 2010 Final Release: SubDiv
Post by: pyrohacker on November 02, 2013, 06:26 PM
I'm reviving this thread to ask for help. I have lost SubDiv, both source and executable. A user has expressed interest in finding it, and I'm hoping that someone still has some part of it.

My apologies for raising the dead. If anyone has the executable or source code for SubDiv — any version number — please either post it or send it to me (email visible on profile page).
Title: Re: NANY 2010 Final Release: SubDiv
Post by: Shades on November 03, 2013, 08:27 AM
The version I have  (executable only, version 1.0.48) is sent to the mail address I found on the web page your profile links to. The mail address is hidden on your profile.

A "strange" way of cloud back up  :P
Title: Re: pyrohacker
Post by: Andreasvb on July 17, 2016, 04:52 AM
Hi, I got a slightly modded version of your code.

I used this before and thought I would sort my download-folder now, but it didn't work today (Windows 10).
Thought I would see if there was an update for it, and read that you lost it.

Also, I wanted only the year, so I put together a little bat script instead. :)

Used some bits from these 2 to get it working so it will not move any .bat:
http://stackoverflow.com/a/22222204 [Batch file to move file based on Month & Year on Date modified to folder with YYYY_MM]
http://stackoverflow.com/a/863627 [In a batch file, how do I delete all files NOT of a certain type]

Code: Visual Basic [Select]
  1. @echo off
  2. cls
  3. choice /c yn /t 10 /d n /m "move all files divided by year?"
  4. if errorlevel 2 goto stop
  5. for %%f in ("%cd%\*") do if not %%~xf==.bat (
  6.   for /f "tokens=1 delims=- " %%a in ("%%~tf") do (
  7.     if not exist "%cd%\%%a" mkdir "%cd%\%%a"
  8.     move "%%~f" "%cd%\%%a"
  9.   )
  10. )
  11. cls
  12. echo all done!
  13. timeout 10
  14. :stop
  15. exit



Here's the code for your script (modded for YYYY-MM)
Code: Autohotkey [Select]
  1. /*
  2. SubDiv
  3. created by pyrohacker on the D.C. Forum
  4. as a NANY 2010 Entry.
  5. */
  6.  
  7. SetWorkingDir %A_ScriptDir%
  8. Menu, TRAY, Icon,,, 1
  9.  
  10. ; Set up GUIs and variables
  11.  
  12. Setup:
  13.  
  14.  
  15. Separator=%SeparatorSelection%
  16. Cleanup=%CleanupSetAt%
  17.  
  18. FormatTime, CurrentYear,, yyyy
  19. FormatTime, CurrentMonth,, MM
  20. FormatTime, CurrentDay,, dd
  21.  
  22. ; Create the settings dialog
  23. Gui, 3:Add, Text,, Creates folders: Year && Months`n:: Andreasvb 2012 mod ::
  24. FormatTime, SmartDate,, yyyy - M - d
  25. Gui, 3:Add, Text,, Please select a date separator:
  26. Gui, 3:Add, Radio, Checked%UnderscoreOn% vSeparatorSelection, Underscore ( _ )
  27. Gui, 3:Add, Radio, Checked%HyphenOn% y+0, Hyphen ( - )
  28. Gui, 3:Add, Radio, y+15 Group Checked, Update Mode
  29. Gui, 3:Add, Radio, y+0 Disabled, Monitor Mode
  30. Gui, 3:Add, Checkbox, y+10 %Recursive% vRecurseSetAt, Recursive subfolders
  31. Gui, 3:Add, Checkbox, y+5 %Cleanup% vCleanupSetAt, Delete empty folders
  32. Gui, 3:Add, Button, y+20 x20 w70 gSendSettings, Apply
  33. Gui, 3:Add, Button, x+15 w70 gActions, Cancel
  34.  
  35. Start:
  36.  
  37. ; Create the Main Actions Dialog
  38. Gui, 2:Add, Button, vUpdate gSortNow h120 w120, Sort this folder now
  39. Gui, 2:Add, Button, vSettings gShowSettings x+0 h120 w120, Change settings
  40. Gui, 2:+ToolWindow
  41. Gui, 2:Show, Center, SubDiv
  42. Pause On
  43.  
  44. Actions:
  45. Pause Off
  46. Gui, 3:Hide
  47. Gui, 2:Show, Center, SubDiv
  48. Pause On
  49.  
  50. SortNow:
  51. Pause Off
  52. Loop %A_WorkingDir%\*, 0, %Recursive% ; Retrieve a list of files to be sorted
  53.         NewFiles = %NewFiles%%A_LoopFileName%`n
  54. UpdateFolders()
  55. StringTrimRight, SortTime, %A_Now%, 6
  56. if Separator = 1
  57.         UnderscoreSort()
  58. if Separator = 2
  59.         HyphenSort()
  60. if ErrorLevel = 0
  61.         GoSub Problems
  62. MsgBox Finished sorting %A_WorkingDir%!
  63. GoSub EndProg
  64.  
  65. UpdateFolders()
  66. {
  67. global
  68.  
  69. If (Cleanup == 1) {
  70.  
  71. Loop, *, 2,
  72. {
  73.   Size = 0
  74.   Loop, %A_LoopFileName%\*, 1, 1
  75.   {
  76.     Size += %A_LoopFileSize%
  77. }
  78. ;MsgBox Size of %A_LoopFileName% is %A_LoopFileSize% bytes.
  79. If (Size < 1) {
  80. FileRecycle, %A_LoopFileName%
  81. }
  82.  
  83. }
  84.  
  85.  
  86. }
  87. Return
  88. }
  89.  
  90. HyphenSort()
  91. {
  92. global
  93. Loop PARSE, NewFiles, `n
  94. {
  95.         FileGetTime DateCreated, %A_LoopField%, C
  96.         FormatTime, YearCreated, %DateCreated%, yyyy
  97.         NowTime := SortTime
  98.         EnvSub, NowTime, %DateCreated%, Days
  99.         IfInString, A_LoopField, SubDiv
  100.                 Continue
  101.        
  102.                 FormatTime, FolderName, %DateCreated%, yyyy
  103.        
  104.        
  105.         FileCreateDir %FolderName%
  106.         FileMove %A_LoopField%, %FolderName%
  107.         EverRun=1
  108. }
  109. Return
  110. }
  111.  
  112. UnderscoreSort()
  113. {
  114.         global
  115.         Loop PARSE, NewFiles, `n
  116.         {
  117.                 FileGetTime DateCreated, %A_LoopField%, C
  118.                 FormatTime, YearCreated, %DateCreated%, yyyy
  119.                 NowTime := SortTime
  120.                 EnvSub, NowTime, %DateCreated%, Days
  121.                 IfInString, A_LoopField, SubDiv
  122.                         Continue
  123.                
  124.                         FormatTime, FolderName, %DateCreated%, yyyy
  125.                
  126.                
  127.                 FileCreateDir %FolderName%
  128.                 FileMove %A_LoopField%, %FolderName%
  129.                 EverRun=1
  130.         }
  131.         Return
  132. }
  133.  
  134.  
  135. ShowSettings:
  136. Pause Off
  137. Gui, 3:Show, Center, Settings Dialog:
  138. Pause On
  139.  
  140. SendSettings:
  141.  
  142. Separator=%SeparatorSelection%
  143. Cleanup=%CleanupSetAt%
  144.  
  145.  
  146. if (RecurseSetAt = 1) and (RecurseWarning = 0)
  147. {
  148.         MsgBox, 4, Caution:, You have instructed SubDiv to sort all files in this folder, including files inside subfolders.`nDoing this will destroy the folder structures in the sorted directory.  Are you sure?
  149. RecurseWarning=1
  150.         IfMsgBox No
  151.                 GoSub ShowSettings
  152. }
  153.  
  154.  
  155. Recursive=%RecurseSetAt%
  156.  
  157. Gui, 3:Hide
  158. Gosub Start
  159.  
  160. Problems:
  161. MsgBox Unknown problems were encountered, but I can't say what...
  162.  
  163. 3GuiClose:
  164. return
  165. EndProg:
  166. 2GuiClose:
Title: Re: pyrohacker
Post by: mouser on July 17, 2016, 11:31 PM
Thanks for sharing your mods!  :up: