#!/bin/sh
LOGS='DriveCleaner'
(
FSTYPE=`diskutil info "
[email protected]" | sed 's/ //g' | grep '^Type' | cut -d':' -f2`
READONLY=`diskutil info "
[email protected]" | sed 's/ //g' | grep "Read-OnlyVolume" | cut -d':' -f2`
if [ "$FSTYPE" = "msdos" ]; then
echo "Type of filesystem on
[email protected] is ${FSTYPE}"
echo "Cleaning
[email protected]"
echo "Delete next files and folders:"
rm -Rf "
[email protected]"/autorun.inf
find "
[email protected]" -depth -name 'Thumbs.db' -print -exec /bin/rm -rf {} \;
find "
[email protected]" -depth -name '.[^.]*' -print -exec /bin/rm -rf {} \;
elif [ "$FSTYPE" = "exfat" ]; then
echo "Type of filesystem on
[email protected] is ${FSTYPE}"
echo "Cleaning
[email protected]"
echo "Delete next files and folders:"
rm -Rf "
[email protected]"/autorun.inf
find "
[email protected]" -depth -name 'Thumbs.db' -print -exec /bin/rm -rf {} \;
find "
[email protected]" -depth -name '.[^.]*' -print -exec /bin/rm -rf {} \;
elif [ "$FSTYPE" = "ntfs" ]; then
echo "System use Native Mac OS X NTFS Driver"
if [ "$READONLY" = "No" ]; then
echo "The NTFS filesystem on
[email protected] in Read/Write mode"
echo "Cleaning
[email protected]"
echo "Delete next files and folders:"
rm -rf "
[email protected]"/.fseventsd
rm -rf "
[email protected]"/.TemporaryItems
rm -rf "
[email protected]"/.Spotlight-V100
rm -rf "
[email protected]"/.Trashes
rm -rf "
[email protected]"/autorun.inf
find "
[email protected]" -depth -name 'Thumbs.db' -print -exec /bin/rm -rf {} \;
find "
[email protected]" -depth -name ".DS_Store" -print -exec /bin/rm -rf {} \;
find "
[email protected]" -depth -name "._*" -print -exec /bin/rm -rf {} \;
else
echo "The NTFS filesystem on
[email protected] is Read only"
fi
elif [ "$FSTYPE" = "ufsd_NTFS" ]; then
echo "System use Paragon NTFS Driver"
if [ "$READONLY" = "No" ]; then
echo "The NTFS filesystem on
[email protected] in Read/Write mode"
echo "Cleaning
[email protected]"
echo "Delete next files and folders:"
rm -rf "
[email protected]"/.fseventsd
rm -rf "
[email protected]"/.TemporaryItems
rm -rf "
[email protected]"/.Spotlight-V100
rm -rf "
[email protected]"/.Trashes
rm -rf "
[email protected]"/autorun.inf
find "
[email protected]" -depth -name 'Thumbs.db' -print -exec /bin/rm -rf {} \;
find "
[email protected]" -depth -name ".DS_Store" -print -exec /bin/rm -rf {} \;
find "
[email protected]" -depth -name "._*" -print -exec /bin/rm -rf {} \;
else
echo "The NTFS filesystem on
[email protected] in Read only mode"
fi
else
echo "Waiting to umount..."
fi
echo "Unmount
[email protected]"
echo "All Done!"
) | logger -s -t $LOGS
/sbin/umount_orig "
[email protected]"