BASH script to enumerate titles and chapters of a dvd and rip the longest one into avi using mencoder. DVD device can be a path to mounted iso (e.g. /mnt/iso/) or a real device (e.g. /media/cdrom0/).

To rip all titles and chapters, try this.

Read the rest of this entry…

BASH script to enumerate titles and chapters of a dvd and rip each into a separate avi using mencoder. DVD device can be a path to mounted iso (e.g. /mnt/iso/) or a real device (e.g. /media/cdrom0/).

To rip just the longest title, try this.

Read the rest of this entry…

Let’s say we’ve got a bunch of directories and we’d like to get counts of how many directories are how many levels deep.

Our directory structure:

$ find . -type d
.
./test1
./test1/test1.1
./test2
./test2/test2.1
./test2/test2.1/test2.2
./test3
./test3/test3.1
./test3/test3.1/test3.2
./test3/test3.1/test3.2/test3.3

There are a number of ways to do this, but I found awk to be most elegant as I wanted to be able to substract an arbitrary number from the result and awk can count and do arithmetic all by itself:

$ find . -type d | while read f; do awk -F'/' '{print NF -1}' | sort | uniq -c | sort -nr; done
      3 2
      3 1
      2 3
      1 4

The shell one line script below will:

1. Find all files below current dir
2. Rename the file with download Source and date range as part of the new file name
3. Renamed file will stay at current location (e.g. file “./path/to/dir/crappyname” becomes “./path/to/dir/DC.Circuit-2006.06.02-2006.07.01.txt”)

Read the rest of this entry…