+ Script info

+ List of available parameters and their script set defaults (null'ed items unless specified get UNSET()):

+ Importing 'cats.ini' key => value pairs from all directories starting in [DOCUMENT_ROOT] thru /sean/code/dir2subs...

+ UNSET()'ing any parameters = 'null'....7 parameters removed

+ Current [PARAM]eters for this page (CATS.INI::[defaults] + URL-based parameters)

+ Current [KEYWORDS] for this page (CATS.INI / [keywords])

+ Retrieving templates...

+ Combining templates; [RECORD]set=>[TABLE]=>[BODY]=>[PAGE]<=NAV

+ Applying S&R on tokenized entries (parameter, _SERVER, keyword, and script)...shrum.net/sean/code/dir2subs
 
Wednesday, Feb 4th  2026 @ 19:00:09  
 
 
  
www . shrum.net /sean/code/dir2subs
All scripting, coding, html, layout, design, .... basically everything here done by yours truly. - S

  

  
 
 
x86 x64 news
 
filter
 clear search
 
 
shrum.net :: Code :: Dir2Subs

 Dir2Subs

A utility for taking a folder of files and placing them into subfolders based on X number of characters in their filename. Useful in brfeaking down a single folder with A LOT of files by creating subdirectories based on the beginning X number of chars of the filename.
 

Introduction

This app will allow you to quickly take a large folder of files and MOVE them into a sub folder structure based on a user definable number of first characters.

It's Windows-based, open source (GNU), and solely written, maintained, hosted, and supported by me, Sean Shrum. Source code is written with AutoIT (.au3) and the most recent version can be found via the source link in the navbar above.  If you're just looking for the latest binary build, it can be downloaded from the binary link in the navbar as well.


Background

My music collection, photo library,....they're huge! I've been storing all the content into single folders but it is apparent that pretty much all file systems today tend to choke on folders with over 10,000 files in them but it's even more of a pain downloading a file list with this many entries in it.  Got the idea when I tried to d/l a file listing of my music lib from my NAS to my broadband phone. :(  When I got home, I made this small util to allow me to take a folder with a lot of files and have it create subfolders that match the beginning x-number of letters in the filename and then move the files in them. Can also be used on collections of filenames that are date based (20070624-354.jpg->2007). Pretty self-explanatory; just answer the prompts (source, destination, # of chars).


Usage

2 modes: Simply run the utility or call in via a batch file for silent mode. 

If you launch the app directly, you will get the following screens. You will be prompted for a  the number of characters to use in the breakout, a source directory, and a destination directory (will default to the source).

If you want to set up a batch call to the utility, the parameters are S (for [s]ource), D (for [d]estination), and C (for number of [c]haracters) in any order. Source and destination can be the same, subfolders will be created directly in the source folder. If your pathname contains spaces, wrap them with dbl-quotes. If the destination parameter is omitted, it will default to the source folder.

dir2subs s=c:\files d="d:\the breakout" c=2
dir2subs c=2 s=m:\music

You will end up with something like this.


FAQs

Q. Will Dir2Subs work with subfolder files as well?

A. No.  This utility is designed to take one folder of files and break them out into subfolders.  The problem with doing subfolder content is that there can be files with the same name in different folders and that poses a number of programmatic issues that I didn't want to have to deal with (eh, I'm lazy). 

 
 
top

Page generation time = 0.0012/s
Page size (minus graphic elements) = 29kb

bookmark

feedback print

back

Since 1992 - shrum.net

Copyright 2026 Sean Shrum

 
 
CATS.PHP [C]ontent [A]cquisition and [T]emplating [S]cript v.4.14 [ 2025.12.14 ] by Sean Shrum