Here you can find some scripts I made. The python ones require Python (obviously), which you can get from [ActiveState].

SortSize 1.0

Sortsize is a small Python script that calculates which files from a given directory fit best into the specified size. Say, for example, that you want to burn a DVD with files from a directory, but you don’t know which ones to include so that the DVD has as less wasted space as possible. You run sortsize, it tries out all file combinations and tells you which one leaves the least wasted space. The simplest way to use it is to open a command prompt, cd to the directory with your files and run it with the size as an argument. By the way, having Psyco installed can speed this script up by ten times or so. Valid size units are:

  • k – kilobyte
  • m – megabyte
  • g – gigabyte
  • c – CD size (736294912 bytes)
  • d – DVD size (4700000000 bytes)

For example, a typical command line would be sortsize.py 1d, which would calculate the size of one DVD. You can also use 2d, 3c, 10m, etc.

Command-line options (you can see these by running sortsize.py --help):

-m SIZE, --minimum=SIZE If you have lots of small files in that directory and only want to include files of size SIZE or larger, use this option.
-g SIZE, --margin=SIZE If you don’t care about filling the entire space and would be fine with leaving a bit of slack, specify this option and searching will stop if it finds a combination that leaves at least SIZE bytes free (you can use k, m, g, etc here as well).
-c, --compatible Just prints a list of names, so you can copy-paste it into a batch file.
-v, --verbose Talks a lot.
-l, --logged Logs stuff. Not very useful, but doesn’t slow down the script.
-f, --fuse=N By default, SortSize considers files that begin with the same 4 letters as one big file. This is useful if, for example, you want to burn a movie and its subtitles, which can’t really be separated. If you find that it thinks of multiple files as one decrease this (0 disables it) or if you want SortSize to look at more characters before it considers two files equal increase it.
-s, --size Sort the file list by size instead of name.

Distributed under the GNU GPL.

PCREname 1.0

PCREname renames files in a directory using regular expressions. For example, if you have files test1.txt to test100.txt and run pcren test sample it will rename files to sample1.txt, sample2.txt, etc. You can use parentheses to capture text and tokens in the format “\\1” to replace them. For example, in the above files, pcren test(\\d+).txt "Test file \\\\1.doc" will rename the files to Test file 1.doc, Test file 2.doc, etc.

Command-line options (you can see these by running pcren.py --help):

-p, --preview Only preview changes (do not actually rename).

Distributed under the GNU GPL.

Episode renamer 0.1

This script renames all video files (of TV show episodes) in a given directory according to their proper names from IMDB. If you have AtomicParsley and the videos are in MP4 format, the script can automatically add the proper tags so iTunes recognizes the videos correctly.

Usage:

Command-line options (you can see these by running episode_rename.py --help):

-p, --preview don’t actually rename anything
-a, --use-atomic-parsley use AtomicParsley to fill in the files’ tags

Distributed under the GNU GPL.

POPdel 1.0

POPdel deletes emails from your email server. If you’ve ever gone on vacation and returned to find a few thousand spam emails on your account and don’t want to bother downloading them, this script will do the job just fine. Point it to your mail server and let it delete everything in a few minutes.

Note: In case you didn’t understand, this DELETES ALL EMAILS FROM YOUR POP SERVER. So don’t say I didn’t warn you.

Usage:

popdel.py <server> <username> <password>

Distributed under the GNU GPL.