DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: pyrohacker  (Read 76,743 times)

pyrohacker

  • Coder, gamer, loving it.
  • Member
  • Joined in 2008
  • **
  • Posts: 46
    • Participated in NANY Challenge Twice
    • Linux User
pyrohacker
« on: December 14, 2009, 02:39 AM »
NANY 2010 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
Download Link See GitHub.
System Requirements
  • Windows
  • A folder
Version History
  • 1.2 - Updated format + 2 new features
  • 1.0 - First working version
Author pyrohacker


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
  • Multiple date formats - Semi-done! (currently supports two separators.)
  • Multiple sorting methods - File extension, Alphabetical, & possible others
  • Multiple work modes - Update or Constant Monitor
  • Optional recursive sorting of subfolders - Done! (Thanks, doctorfrog!)
  • Optional sorting of subfolders themselves
  • Independent website
  • Help file (only if it becomes complex enough)

Possible Features (not set in stone)
  • Undo feature - Probable, but not a priority.
  • Custom user sort fields - Not for a long time, but keep your hopes up!

Screenshots
SubDiv Screenshot 2.jpg NewScreenshot.png

Usage

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

Using the Application
Run the program! Current settings are:
  • Recurse - take files from sub-folders and sort them as well.
  • Cleanup - delete empty folders every time a files are sorted.

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!
Funny that programmers chose the phrase "Hello, World" while most of us are introverts.
« Last Edit: November 20, 2013, 06:16 AM by pyrohacker »

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,046
Re: NANY 2010 Teaser: SubDiv
« Reply #1 on: December 28, 2009, 11:46 AM »
Sounds like a useful app.  Any word on a release?

supermamon

  • Participant
  • Joined in 2009
  • *
  • Posts: 1
Re: NANY 2010 Teaser: SubDiv
« Reply #2 on: December 29, 2009, 02:06 AM »
Not meant to discourage but maybe you can get some inspiration from Belvedere
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.

pyrohacker

  • Coder, gamer, loving it.
  • Member
  • Joined in 2008
  • **
  • Posts: 46
    • Participated in NANY Challenge Twice
    • Linux User
Re: NANY 2010 Final Release: SubDiv
« Reply #3 on: January 01, 2010, 06: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.
Funny that programmers chose the phrase "Hello, World" while most of us are introverts.
« Last Edit: January 01, 2010, 06:42 AM by pyrohacker »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: NANY 2010 Final Release: SubDiv
« Reply #4 on: January 01, 2010, 06: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.

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • Coding Snacks
Re: NANY 2010 Teaser: SubDiv
« Reply #5 on: January 04, 2010, 04:02 PM »
Not meant to discourage but maybe you can get some inspiration from Belvedere
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...

http://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.

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
Re: NANY 2010 Final Release: SubDiv
« Reply #6 on: January 04, 2010, 09: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...



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.

pyrohacker

  • Coder, gamer, loving it.
  • Member
  • Joined in 2008
  • **
  • Posts: 46
    • Participated in NANY Challenge Twice
    • Linux User
Re: NANY 2010 Final Release: SubDiv
« Reply #7 on: January 05, 2010, 03:31 AM »
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, if anyone wants to take a look at it.)
Funny that programmers chose the phrase "Hello, World" while most of us are introverts.
« Last Edit: January 07, 2010, 05:01 AM by pyrohacker »

dilligaff

  • Participant
  • Joined in 2009
  • *
  • Posts: 1
Re: NANY 2010 Final Release: SubDiv
« Reply #8 on: January 06, 2010, 05:12 PM »
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.

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
Re: NANY 2010 Final Release: SubDiv
« Reply #9 on: January 07, 2010, 01:03 AM »
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.

Tuxman

  • OMG not him again!
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,522
    • Participated in NANY Challenge Seven Times
Re: NANY 2010 Final Release: SubDiv
« Reply #10 on: January 09, 2010, 04:36 AM »
A new suggestion: Regex based sorting. If a file matches a certain expression, put it into $folder.
I bet when Cheetahs race and one of them cheats, the other one goes "Man, you're such a Cheetah!" and they laugh & eat a zebra or whatever.

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
Re: NANY 2010 Final Release: SubDiv
« Reply #11 on: January 13, 2010, 12:14 AM »
SubDiv has just been written up on Elite Freeware:
SubDiv - Elite Freeware.png
http://elitefreeware.blogspot.com/2010/01/nany-2010-entry-subdiv.html


pyrohacker

  • Coder, gamer, loving it.
  • Member
  • Joined in 2008
  • **
  • Posts: 46
    • Participated in NANY Challenge Twice
    • Linux User
Re: NANY 2010 Final Release: SubDiv
« Reply #12 on: January 13, 2010, 02:08 AM »
Thanks for letting me know, Perry!  It's good to see NANY getting some publicity.
Funny that programmers chose the phrase "Hello, World" while most of us are introverts.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: NANY 2010 Final Release: SubDiv
« Reply #13 on: January 20, 2010, 11:25 PM »
Mentioned here:
http://www.addictivetips.com/windows-tips/organize-files-into-folders-automatically-based-on-date-created/

pyrohacker

  • Coder, gamer, loving it.
  • Member
  • Joined in 2008
  • **
  • Posts: 46
    • Participated in NANY Challenge Twice
    • Linux User
Re: NANY 2010 Final Release: SubDiv
« Reply #14 on: January 27, 2010, 03:49 AM »
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?
Funny that programmers chose the phrase "Hello, World" while most of us are introverts.

adi_barb

  • Knowledge comes, but wisdom lingers.
  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 71
    • Participated in NANY Challenge Once
Re: NANY 2010 Final Release: SubDiv
« Reply #15 on: December 13, 2010, 11:58 AM »
Why is SubDiv famous?

SubDiv is famous because it is a simple tool that allows you to manage and organize folders content.  :Thmbsup:

scasplte2

  • Participant
  • Joined in 2011
  • *
  • Posts: 1
Re: NANY 2010 Final Release: SubDiv
« Reply #16 on: February 02, 2011, 08: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.
« Last Edit: February 02, 2011, 08:08 PM by scasplte2 »

pyrohacker

  • Coder, gamer, loving it.
  • Member
  • Joined in 2008
  • **
  • Posts: 46
    • Participated in NANY Challenge Twice
    • Linux User
Re: NANY 2010 Final Release: SubDiv
« Reply #17 on: November 02, 2013, 11: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).
Funny that programmers chose the phrase "Hello, World" while most of us are introverts.

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,954
Re: NANY 2010 Final Release: SubDiv
« Reply #18 on: November 03, 2013, 02:27 PM »
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
The easy path is usually downhill...

Andreasvb

  • Participant
  • Joined in 2009
  • *
  • Posts: 1
Re: pyrohacker
« Reply #19 on: July 17, 2016, 09: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: ( vb)
@echo off
cls
choice /c yn /t 10 /d n /m "move all files divided by year?"
if errorlevel 2 goto stop
for %%f in ("%cd%\*") do if not %%~xf==.bat (
  for /f "tokens=1 delims=- " %%a in ("%%~tf") do (
    if not exist "%cd%\%%a" mkdir "%cd%\%%a"
    move "%%~f" "%cd%\%%a"
  )
)
cls
echo all done!
timeout 10
:stop
exit



Here's the code for your script (modded for YYYY-MM)
Code: ( autohotkey)
/*
SubDiv 
created by pyrohacker on the D.C. Forum
as a NANY 2010 Entry.
*/

#NoEnv
#SingleInstance Force
SendMode Input
SetWorkingDir %A_ScriptDir%
Menu, TRAY, Icon,,, 1

; Set up GUIs and variables

Setup:

Gui, Destroy
Gui, 2:Destroy
Gui, 3:Destroy

Separator=%SeparatorSelection%
Cleanup=%CleanupSetAt%

FormatTime, CurrentYear,, yyyy
FormatTime, CurrentMonth,, MM
FormatTime, CurrentDay,, dd

; Create the settings dialog
Gui, 3:Add, Text,, Creates folders: Year && Months`n:: Andreasvb 2012 mod ::
FormatTime, SmartDate,, yyyy - M - d
Gui, 3:Add, Text,, Please select a date separator:
Gui, 3:Add, Radio, Checked%UnderscoreOn% vSeparatorSelection, Underscore ( _ )
Gui, 3:Add, Radio, Checked%HyphenOn% y+0, Hyphen ( - )
Gui, 3:Add, Radio, y+15 Group Checked, Update Mode
Gui, 3:Add, Radio, y+0 Disabled, Monitor Mode
Gui, 3:Add, Checkbox, y+10 %Recursive% vRecurseSetAt, Recursive subfolders
Gui, 3:Add, Checkbox, y+5 %Cleanup% vCleanupSetAt, Delete empty folders
Gui, 3:Add, Button, y+20 x20 w70 gSendSettings, Apply
Gui, 3:Add, Button, x+15 w70 gActions, Cancel

Start:
Gui, 2:Destroy

; Create the Main Actions Dialog
Gui, 2:Add, Button, vUpdate gSortNow h120 w120, Sort this folder now
Gui, 2:Add, Button, vSettings gShowSettings x+0 h120 w120, Change settings
Gui, 2:+ToolWindow
Gui, 2:Show, Center, SubDiv
Pause On

Actions:
Pause Off
Gui, 3:Hide
Gui, 2:Show, Center, SubDiv
Pause On

SortNow:
Pause Off
Loop %A_WorkingDir%\*, 0, %Recursive% ; Retrieve a list of files to be sorted
	NewFiles = %NewFiles%%A_LoopFileName%`n
UpdateFolders()
StringTrimRight, SortTime, %A_Now%, 6
if Separator = 1
	UnderscoreSort()
if Separator = 2
	HyphenSort()
if ErrorLevel = 0
	GoSub Problems
MsgBox Finished sorting %A_WorkingDir%!
GoSub EndProg

UpdateFolders()
{
global

If (Cleanup == 1) {

Loop, *, 2,
{
  Size = 0
  Loop, %A_LoopFileName%\*, 1, 1
  {
    Size += %A_LoopFileSize%
}
;MsgBox Size of %A_LoopFileName% is %A_LoopFileSize% bytes.
If (Size < 1) {
FileRecycle, %A_LoopFileName%
}

}


}
Return
}

HyphenSort()
{
global
Loop PARSE, NewFiles, `n
{
	FileGetTime DateCreated, %A_LoopField%, C
	FormatTime, YearCreated, %DateCreated%, yyyy
	NowTime := SortTime
	EnvSub, NowTime, %DateCreated%, Days
	IfInString, A_LoopField, SubDiv
		Continue
	
		FormatTime, FolderName, %DateCreated%, yyyy
	
	
	FileCreateDir %FolderName%
	FileMove %A_LoopField%, %FolderName%
	EverRun=1
}
Return
}

UnderscoreSort()
{
	global
	Loop PARSE, NewFiles, `n
	{
		FileGetTime DateCreated, %A_LoopField%, C
		FormatTime, YearCreated, %DateCreated%, yyyy
		NowTime := SortTime
		EnvSub, NowTime, %DateCreated%, Days
		IfInString, A_LoopField, SubDiv
			Continue
		
			FormatTime, FolderName, %DateCreated%, yyyy
		
		
		FileCreateDir %FolderName%
		FileMove %A_LoopField%, %FolderName%
		EverRun=1
	}
	Return
}


ShowSettings:
Pause Off
Gui, 3:Show, Center, Settings Dialog:
Pause On

SendSettings:
Gui, 3:Submit

Separator=%SeparatorSelection%
Cleanup=%CleanupSetAt%


if (RecurseSetAt = 1) and (RecurseWarning = 0) 
{
	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?
RecurseWarning=1
	IfMsgBox No
		GoSub ShowSettings
}


Recursive=%RecurseSetAt%

Gui, 3:Hide
Gosub Start

Problems:
MsgBox Unknown problems were encountered, but I can't say what...
ExitApp

3GuiClose:
Gui, 3:Cancel
return
EndProg:
GuiClose:
2GuiClose:
ExitApp 

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: pyrohacker
« Reply #20 on: July 18, 2016, 04:31 AM »
Thanks for sharing your mods!  :up:

Original address: https://www.donationcoder.com/forum/index.php?topic=20975.0