Re: Program database

From: Rhialto <rhialto_at_falu.nl>
Date: Sat, 19 Sep 2009 23:45:58 +0200
Message-ID: <20090919214558.GA19779@falu.nl>
On Wed 16 Sep 2009 at 09:56:12 +0200, ruud.baltissen@apg.nl wrote:
> I have a lot of CD's filled with images and I'm sure that I have more
> then one copy of a lot of files. But finding files is a problem as well.
> Having a database could simplify things. So my first question: is there
> a program available that enables you to read floppies/images and to
> store the information about programs, headers, sizes etc. in a database?

Well, I once made a shell script to look through a directory tree (on
Unix) and try to list all C= files inside various image files and
compression/archive files. It does require various helper programs for
looking inside files.

It doesn't do anything database-like; it just outputs
disk-directory-listings.

I'll include it here, it isn't that big.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.
#!/bin/sh
#set -x

here=`pwd`
PATH=$PATH:$HOME/bin
tmpdir=/tmp/listit$$

ls -lR >ls-lR
du -k >du-k

find $here -type f -print |
egrep -i '\.(zip|lha|lzh|zoo|[dDtT]64|lnx|tar\.gz|tgz|lnx\.gz|d64\.gz)$' |
sort -f |
while read fn
do
	#echo "fn = $fn"

	mkdir $tmpdir || { echo "Cannot mkdir $tmpdir"; exit 1; }
	cd $tmpdir

	echo ""
	case $fn in
	*.zip|*.ZIP)
		unzip -l "$fn" 2>&1
		unzip "$fn" '*.[dDtT]64' '[1-4]!*' '*.lnx' >/dev/null 2>&1
		;;
	*.lha|*.LHA|*.lzh|*.LZH)
		# lha reads stdin... feed it nothing.
		echo "Archive:  $fn"
		lha l "$fn" </dev/null 2>&1 
		lha x "$fn" '*.?64' '?!*' '*.lnx' </dev/null >/dev/null 2>&1
		;;
	*.[dDtT]64|./[1-4]!*|*.lnx)
		ln -s "$fn" .
		;;
	*.tar.gz|*.tgz)
		echo "Archive:  $fn"
		tar tvzf "$fn"
		tar xvzf "$fn" '*.[dDtT]64' '[1-4]!*' '*.lnx' >/dev/null 2>&1
		;;
	*.d64.gz|*.lnx.gz)
		gunzip <$fn >`basename $fn .gz`
		;;
	esac

	find . -print |
	egrep '\.([dDtT]64|lnx)|[1-4]!' |
	while read image
	do
		#echo "image = $image"

		case "$image" in
		*.[dD]64)
			echo "Directory of $fn -> $image:"
			c1541 "$image" -list 2>&1 | grep -v "VDrive:"
			;;
		*.[tT]64)
			echo "Tape contents of $fn -> $image:"
			# we want to see stderr only here
			c1541 -format "no name,00" d81 noname -tape "$image" 2>&1 1>/dev/null
			;;
		*.lnx)
			echo "Directory of $fn -> $image:"
			c1541 -format "no name,00" d64 noname -unlynx "$image" -list 2>&1 | grep '^[0-9]'
			;;
		./1!*)
			echo "Directory of $fn -> $image:"
			zipname=`echo $image | sed 's/^....//'`
			c1541 -zcreate noname "$zipname" -attach noname -list 2>&1 | grep '^[0-9]'
			;;
		esac
	done

	cd /tmp
	rm -rf $tmpdir
done |
sed 's;'$here';;g' |
tee /dev/tty |
gzip -v9 > unpacked-contents.gz

       Message was sent through the cbm-hackers mailing list
Received on 2009-09-19 23:00:04

Archive generated by hypermail 2.2.0.