Posts

Showing posts with the label bash

Bash and Compact Disc(CD) backups

 On the previous post, I went over how to automate copying floppy disks with only providing a Title (identifier) for the image created. This script is smiliar, but uses HandBrakeCLI to query the disc in the drive for the Chapters/Titles.  In this case, we are only querying the chapters in the Title 0 on the disc.  HandBrake has a GUI to do this manually. #!/bin/bash NAME="UNKNOWN"; function wait_for_cd_dvd_mount() { # Query the CD/DVD Drive to see if the disc is detected blkid /dev/sr0 2&>1; last_run=$?; # If blkid's exit code is not 0(Zero), then the disc detected while [[ $last_run -ne 0 ]]; do echo "Device not mounted. Waiting..."; sleep 1; blkid /dev/sr0; last_run=$?; done } function extract_videos() { # Query all CD/DVD Titles via HandBrakeCLI (-t 0 is to scan all titles) for TITLE in $(HandBrakeCLI -i /dev/sr0 --no-dvdnav -t 0 2>&1 | grep title | grep -v...

Bash and mass backup of floppy disks

 While dealing with cleaning out the family house, I have been tasked to backup all the pictures from floppy disks (3 1/2") and Compact Discs(CDs).  Thankfully I still had both a CD reader and a 3 1/2" Floppy disk drive to read them. As any sort of media goes bad over time, I first had to copy the contents onto my local drive before extracting and inspecting the contents of each.  This brings me to a problem with the 3 1/2" Floppy disks, as most of them had read errors on them.  This caused headaches when attempting to using a the standard COPY command. This is where I turned to my trusty friend ddrescue*.  This would allow me to copy the data into an IMG format, while retrying to all errors that come up while reading from the disk.   This brings me to attempting to automate the process.  A quick bash script allowed inputting of the title of the disk, along with looping indefinitely. This is a pretty simple script that requires 'sudo' access to ru...