something completely different: MyFolderMaker.py [Sat, 26 Sep 2009 18:34:35 +0000]
I haven't hidden the fact that this blog exists, in part, as a resume builder. And I think that programming skills are a valuable asset in digital libraries. Frankly, LIS programs need to address this to keep their graduates competitive. But that's another post altogether ...
Anyway, at work yesterday (Friday) I made a little Windows .bat file [http://en.wikipedia.org/wiki/Batch_file#Windows_NT] that creates a folder named after every line in a given plain text file.
When I came home, I napped until nearly midnight and woke up in an odd, creative state: when I'm mostly mind and hardly any body. Whether I'm hardly anybody is a matter of opinion.
I decided to make a fancier version of the batch file using Python [http://www.python.org/about/], which is named after Monty Python's Flying Circus [http://pythonline.com/]. In all seriousness, that's a huge part of the reason I decided to start learning Python.
The program can do one of the following:
1. Ask you to supply a path and then mimick the folder structure (all new folders are created inside a folder called "MyFolderListFolder" to prevent accidental messes).
2. Read from a plain text file of yours called "MyFolderList.txt" and make folders named for each line in the text file (all new folders are created inside a folder called "MyFolderListFolder" to prevent accidental messes). Subfolders can be made using this format (Unix/Linux users need to use forward slashes, Windows users can use either):
3. Take you to this page if you'd simply like to see the source code and learn more about it. Of course, .py files can be opened in a text editor so this is only really useful for the Windows .exe version I compiled with cx_Freeze [http://cx-freeze.sourceforge.net/].
The program has some error checking built in. For example, if your text file has blank rows or duplicates, it will alert you under most situations that there's a problem you need to fix.
The source code link is below if anyone is interested ... real programmers likely will - and should - laugh, but I'm still learning.
A text file of the program (i.e. source code) is available here [http://blog.humaneguitarist.org/uploads/MyFolderMaker.txt].
You assume all responsibility for use.