Various command-line utilities with source code

Sorry I’m so incognito online these days (outside of being away for the holidays). I’m sure the reasons are obvious enough and not worth moaning about.

I figured it was about time I uploaded a bunch of utilities I’ve written and put them all in one place, along with the sourcecode. All of these are written in the excellent PowerBasic Console Compiler (RIP Bobe Zale) and compile under version six. They’re all command-line Windows utilities, although a few of them can be run directly. All are no-warranty use-at-your-own-risk freeware, and as far as I’m concerned the source code is hereby released into the public domain and you can do as you please with it without having to credit me. I’ll upload some more later…

Download tool: clipcalc.exe
Download source code: clipcalc.bas

This tool is a real time-saver. It performs math on the clipboard. You define what operation you’d like to do (for example, subtracting 0.25) and any time you copy a number to the clipboard, the operation is performed and then copied back to the clipboard. This essentially lets you insert an automated calculator into any program, and is extremely useful for performing repetative operations that involve math. For example, if you have to move a set of images 0.125″ to the right, you could specify a “plus 0.125″ operation, and then go through all your images, selecting the current location, pressing Copy, at which point the operation is automatically done, and then pressing Paste to put the new value right back where you got the original value from. This tool is extremely easy to use and very useful.

clipcalc - clipboard calculator
monitors the clipboard and performs math on it
usage operation value [/r]
    operation is * + - / ^
    returns result of {clipboard} {operation} {value}
    [/r] pushes the result back to the clipboard (optional)

Download tool: deperiod.exe
Download source code: deperiod.bas

This tool cleans filenames from a “downloaded” style to something simpler, converting periods to spaces, cleaning dates, and remove extra tags like Xvid.

deperiod - remove periods from filenames (but preserve extension)
 (also removes underscores, double spaces, and normalizes brackets)
usage: deperiod [/m[u|l]] [/c] [/d|/D] [/y[c]] [/k[c]] filespec
include /c before filespec to force each rename to be confirmed
include /d to include directories as well as files, or /D to only do dirs
include /y to look for dates (ie. 4-digit year) and put them in brackets and
 toss everything after that -- ie. "blah 2010 xxx"=>"blah (2010)".
 (valid years are between 1920 and 2020; all others are ignored).
making it /yc forces confirms, but only on files affected by this rule
 (a good idea since /y is more potentially destructive)
include /k (or /kc to confirm) to kill common terms like "Xvid"
include /m to converted to Mixed-Case if all lower- or UPPERcase
 (optionally /ml converts only from lowercase, or /mu for upper)
filespec can be a literal filename or wildcards

Download tool: dirsort.exe
Download source code: dirsort.bas

This tool sort files in a directory into a collection of multiple subdirectories.

by Shannon Larratt /
This tool creates a batch file to move files and/or directories into a new
sorted and ordered directory tree. Run with /? to see command line options.

Usage: dirsort [optionlist]
 /files = only move files
 /dir = only move directories
 /both = move both files and directories

 /newsort = specify that this is a "virgin" sort and all directories are fair game
 /resort = attempt to skip directories from a previous sort

 /skipthe = remove "the" and "a"/"an" from the start of item names
 /theok = treat "the" as a valid part of an item name

 /alpha = sort into simple a-z directories
 /nestalpha = sort into nested a/aa-z/zz directories
 /2alpha = sort into aa-zz two letter alphabetical directories
 /foldersize=## = sort into folders with a maximum average number of files in them
   /bothnames = when using foldersize, include start and end names in dir name
   /dontpad = when using foldersize, don't pad the dir names for matching length
 /selfname=## = sort into directories based on the first ## letters of filename

 /allare0 = when naming/sorting treat all numbers as '0' (the same)
 /unique123 = treat all numbers as unique "letters"

Note: Command-line and manual function can be mixed.

Download tool: findemail.exe
Download source code: findemail.bas

This tool harvests all email addresses mentioned in a file or set of files.

findemail // by shannon larratt //
harvests all unique email addresses from a file or set of files
-> usage: findemail files.ext (wildcards are ok) [/headers]
-> output is to stdio
-> /headers specifies that only from/to addresses should be used
error: file not found or not specified

Download tool: fixcrlf.exe
Download source code: fixcrlf.bas

This tool convert *nix style text files to CRLF delimited Windows files.

This tool makes sure that all linebreaks are "proper" CRLF style.
Solo linefeeds and solo carriage returns are converted.
Usage: fixcrlf filespec
ie. single file use might be "fixcrlf myfile.txt" or multi-file might be "fixcrlf *.xml"

Download tool: killfirstword.exe
Download source code: killfirstword.bas

This tool remove the first word from a set of filenames.

KILLFIRSTWORD: Removes the first word from a set of files.
Usage is:
 KillFirstWord [separator] filespec
 Filespec must be specific (*.* is OK) just to avoid accidental use.
 Optional separator defines a wordbreak character other than a space.

Download tool: nextdir.exe
Download source code: nextdir.bas

This tool move from the directory you’re in to the next one. That is, it goes up a directory, then looks at the subdirectories, and enters the one alphabetically after the one you were just in. Note that it just copies the command into the clipboard, so you need to run this and then past the result into the command line (otherwise windows will move you to the directory, and then move you right back).

NextDir / Shannon Larratt / / / Free Software

Usage: Just type 'nextdir'
Effect: This moves you to the next alphabetical directory. It's the equivalent
    of typing 'cd ..' and then moving into the next directory alphabetically
    from where you just started.

Download tool: numdirf.exe
Download source code: numdirf.bas

This tool rename files inside all subdirectories with numbered prefixes so they can be merged into a single directory and still retain their order.

prefix and number files in subdirectories
usage: prenumfsd prefix-text
files in dir # renamed to "prefix-text ### origfile.ext"
    ### is the directory number, not the file number

Download tool: pren.exe
Download source code: pren.bas

This tool quickly adds a prefix to a set of filenames.

PREN: Prefix Rename
Usage is:
 pren [filespec] ["]prefix["]
 If you want to specify a filespec, it is assumed to include wildcards; * or ? are OK.

Download tool: seriescheck.exe
Download source code: seriescheck.bas

This tool detects files that are missing from sequential numbered sets. That is, if you have a set of files called file001.txt through file100.txt and file099.txt doesn’t exist, this will tell you.

Seriescheck ...
Program to find missing files from numbered sequences of files
by Shannon Larratt / / free software

Usage: seriescheck filename####*.* or filename@@@@*.*
...that is, a standard filemask, where '#' or '@' indicate a digit counter.
...'@' indicates a 0-padded number, and '#' a number that is not padded.

   'image###.jpg' searches for files from 'image1.jpg' to 'image999.jpg'
   'data @@@@*.jpg' searches for files from 'data 0001*.jpg' to 'data 9999*.jpg'

Download tool: shownohtml.exe
Download source code: shownohtml.bas

This quick’n'dirty tool to remove html tags from files (ie. converts html files to text files essentially).

Usage: shownohtml filename.ext
outputs file with HTML tags trimmed to stdio
alternate use with wildcards overwrites files

Download tool: splitmbx.exe
Download source code: splitmbx.bas

This tool splits Eudora mailbox (mbx) files into individual emails (probably works on *nix mailboxes as well).

splitmbx // by shannon larratt //
create a gazillion text files with one email per file, from eudora mailbox(es)
--> usage: splitmbx filename.ext [/s=searchterm]
     *wildcards are ok in filename
     *optional search term means that only emails matching search will be output
     *if searchterm is a file it can be a list of terms, one per line
     *search is case INsensitive
     *in search mode, new mbx files are created, in normal mode txt files per email

Download tool: vcf2txt.exe
Download source code: vcf2txt.bas

This tool converts vcf files to readable text files. So for example, if you use a tool like “Groups” to email yourself a VCF file of all the contacts on your phone, this takes that file and turns it into something easy to read that you can email yourself or print out for backup/archival.

vcf2txt // converts vcf (vcard) files to simple text files
by shannon larratt // // freeware * sloppy and mostly untested

normal commandline usage:
vcf2txt filein.vcf [-o fileout.txt] [options/mode selector]

filein.vcf is the vcf file to load
output file is to the same filename with the extension changed to .txt
 (unless you use the -o fileout.txt option to specify a new name)
options/modes are (default is -ot):
 -os  simple output, name, email, and phone number(s) only
 -oc  clean output, name on first line, supplemental data in following lines
 -ot  total output, output everything know, with labels, excluding photos

Download tool: webdir.exe
Download source code: webdir.bas

This tool convert filenames to lowercase and replace spaces with dashes.

This will make all files lower case and replaces spaces with dashes!


  1. SarahV wrote:

    That water looks amazing! Gorgeous color.

    Monday, January 7, 2013 at 8:20 pm | Permalink
  2. Elizabeth wrote:

    In this pic the blue is making your eyes tawny. Cool effect.

    Tuesday, January 8, 2013 at 2:09 pm | Permalink
  3. Lindsay wrote:

    That looks suspiciously like the water off Cancun/Playa del Carmen/Cozumel…

    Friday, January 11, 2013 at 10:19 am | Permalink
  4. QueenofCrows wrote:

    Oooo, I’d love to get my hands on your Dialude Glider (? I think I’ve got the name slightly wrong) program. Ever since I first heard of it six or seven years ago, I’ve wondered what it would be like to play around with, as the idea of it ties into some audio/video projects I’m brewing…How could I go about getting my hands on it?

    Saturday, January 12, 2013 at 5:35 pm | Permalink
  5. Shannon wrote:

    QueenOfCrows… I wish I could help you, I lost the source code to all versions of that ages ago… Although I *think* that the source code to an early version may be floating around various file archives that snag shareware/freeware. It might be almost impossible to use but it’s possible there’s enough meaningful sourcecode to pull out the core algorithms.

    Tuesday, January 22, 2013 at 6:21 pm | Permalink
  6. Shannon wrote: … That refers to it, the file seems to be “DG2.ZIP”, but I haven’t been able to find it yet.

    Tuesday, January 22, 2013 at 6:23 pm | Permalink
  7. QueenofCrows wrote:

    Thank you, Shannon! Even if all I have is the correct name and a little info, perhaps someday I’ll connect with someone who has the time and the technical know-how to track it down and rebuild the source code. I find art created as technical experimentation (eg math music, certain fractals) terrifically fascinating.

    Wednesday, January 23, 2013 at 6:22 pm | Permalink
  8. QueenofCrows wrote:

    I don’t know the first thing about Unix or building code, so I’m not sure if this includes the actual ’90s source code, but I just downloaded what I believe is your Dilaudid Glide from here:

    Sunday, March 10, 2013 at 2:09 am | Permalink
Wow Shannon, that's really annoying! What is it, 1997 on Geocities? Retroweb is NOT cool!

Post a Comment

Your email is never published nor shared. Required fields are marked *