A Non-Networked File System

This page gives a short overview of a non-networked file system, which I have implemented to transfer files from my Sparc station in my office and my Linux Box at home, using a MS-DOS based file system as intermediate. The idea is syncronize two file systems with are on machines with no network connection.

It is based on time-stamps, and compares the modification times of files on the two machines. It also keeps a list of files (directories) that need to be ignored (e.g., it's no use to copy executables, between the two systems). The system consists of two scripts and one C program.

The implementation that I use is rather primitive, and also contains some unwanted features, but although I have often thought about improving it, I have never come to do it, as it does work fine for the purpose I am using it.

Compare program

The core of the system is based on the dcompare.c program. This program basically compares two directory listings (produced by ls), and asks the user about how the differences should be dealt with.

The program expects that the file .dt.in contains the directory listing of the other system, and that the file .dt.new the current directory listing of the you are exporting from. All files that are newer in .dt.new than in .dt.in, are candidates for being exported to the other machine. For each of this file the users can give the following replies:

To keep track of which files (or directories) should be ignored the file .dt.ignore is read and modified. This file can be editted by hand.

At the end the program writes the following files:

(Of course, the .dt.ignore is also written.)

Export script

The script starts with:
Then I have a line to also save a copy of by incoming mail box:
cp /usr/spool/mail/xxxx ~/inbox
Then I have to collect all the files.
set dtz = $1
echo $dtz
ls -dalg * */* */*/* >.dt.new
Actually, I am using something like the following, because the argument list gets too long. (Not so, nice, but it works.)
ls -dalg * >.dt.tmp
ls -dalg Calendar/* >>.dt.tmp
ls -dalg News/* News/*/*  >>.dt.tmp
ls -dalg Mail/* Mail/*/* >>.dt.tmp
sort +0.54 <.dt.tmp | uniq >.dt.new
rm .dt.tmp
Then I call the compare program, which compares .dt.new with .dt.out, and generates .dt.make, .dt.out and .dt.del. It also read and writes .dt.ignore.
And now to the real job:
chmod +x .dt.make .dt.del
echo do:
more ./.dt.make
echo zipping:
gzip .dt.disk
And copy everything to disk:
echo copy to a:
mdel a:$dtz.DTZ
mdel a:$dtz.LS
echo mcopy .dt.disk.gz a:$dtz.DTZ
mcopy .dt.disk.gz a:$dtz.DTZ
echo mcopy .dt.out a:$dtz.LS
mcopy .dt.out a:$dtz.LS
Clean-up and deleting old stuff. (Somehow this is nice. I do find all core-file that are generated, and can clean them up immediately.)
rm -i .dt.disk.gz
echo deleting:
rm .dt.out .dt.new .dt.make .dt.del

Import script

echo copy $1.DTZ to .dt.disk.gz
mcopy a:$1.DTZ .dt.disk.gz
echo copy $1.LS to .dt.in
mcopy a:$1.LS .dt.in
if ( -f .dt.disk.gz ) then
   echo unzip .dt.disk.gz to .dt.disk
   gzip -d .dt.disk.gz
   echo .dt.disk.gz not found
if ( -f .dt.disk ) then
   echo untar .dt.disk
   tar -xwf .dt.disk
   rm -i .dt.disk
   echo .dt.disk not found

home and email