FileRecovery-nyufile / src / test / ms6.sh
ms6.sh
Raw
#!/bin/bash
# This is the test for Milestone 6
# The tested files are TANG.TXT and YANG.TXT

echo -e "\033[0;32mInitializing disk...\033[0m"
cd ../../
dd if=/dev/zero of=fat32.disk bs=256k count=1
mkfs.fat -F 32 -f 2 -S 512 -s 1 -R 32 fat32.disk

echo -e "\033[0;32mMounting disk...\033[0m"
rm -rf /mnt/disk
mkdir /mnt/disk
mount fat32.disk /mnt/disk
echo "My last name is Tang." > /mnt/disk/TANG.TXT
echo "My first name is Yang." > /mnt/disk/YANG.TXT
sync
ls -l /mnt/disk

echo -e "\033[0;32mDeleting file...\033[0m"
rm -f /mnt/disk/TANG.TXT /mnt/disk/YANG.TXT
ls -l /mnt/disk
umount /mnt/disk

cd src/main
echo -e "\033[0;32mListing deleted version...\033[0m"
./nyufile ../../fat32.disk -l
echo -e "\033[0;32mRecovering deleted file...\033[0m"
./nyufile ../../fat32.disk -r TANG.TXT
echo -e "\033[0;32mListing undeleted version...\033[0m"
./nyufile ../../fat32.disk -l

echo -e "\033[0;32mChecking...\033[0m"
cd ../../
mount fat32.disk /mnt/disk
ls -l /mnt/disk
umount fat32.disk

echo -e "\033[0;32mDone.\033[0m"
cd src/test