blog:x68_directory_backup

This is an old revision of the document!


X68000 - Backing up folders

You can copy content out of an emulated X68000 hard drive using Disk Explorer, but it's buggy and even a Linux filesystem can choke on certain S-JIS characters from the Sharp.

It's much easier to archive up the folders you want to backup or transfer, and then keep them zipped until they need restoring, or are copied to their destination.

Normally, in MS-DOS you would do something like:

for /D %%D IN (A:\Games\*.) DO zip.exe $D.ZIP $D

… which would expand to include all of the directories under A:\Games. However, the command prompt in Human68K does not support the /D directory switch for the for statement, meaning it only matches files.

Rather than doing this by hand for all the hundreds of games folders on the emulated hard drive, I came up with an automated solution using a few small extra commands.

#!bash
#######################################
#
# A quick script to backup a directory
# of folders to individual archives on
# Human68k... since the for %% in ()
# syntax does not work for directories
#
# Needs:
#
# - zip.x
# - bash.x
# - ls.x
# - tr.x
#
#######################################

OUTPUT="E:\backup\a\games"

echo "Generating list..."

ls.x -1 | tr.x -d '\015' > files.txt 

>cmd.bat

echo "Starting to write batch file..."

while read D
do

	test -d "$D"
	if [ "$?"=="0" ]
	then

		d=`echo $D`
      
		echo -n "zip.x -b A:\\tmp -0 $OUTPUT\\$d.zip $d\\*.*"  >> cmd.bat
		echo -e "\r" >> cmd.bat     
	fi

done < files.txt

echo "Now run cmd.bat"
  • blog/x68_directory_backup.1617716122.txt.gz
  • Last modified: 2021/04/06 14:35
  • by john