Skip to content

Instantly share code, notes, and snippets.

@4ft35t

4ft35t/ntfsutil.sh

Forked from jsfaint/ntfsutil.sh
Last active Aug 29, 2015
Embed
What would you like to do?
#!/bin/bash
mount_disk()
{
sudo umount $disk
mkdir ~/Desktop/$diskname
sudo mount_ntfs -o rw,auto,nodev,nobrowse,noowners,noatime $disk ~/Desktop/$diskname
echo "Mount $disk to ~/Desktop/$diskname"
open ~/Desktop/$diskname
}
umount_disk()
{
sudo umount $disk
echo "Unmount $disk from ~/Desktop/$diskname"
rmdir ~/Desktop/$diskname
}
#Start from here
if [[ $# -ne 2 ]]; then
echo "$0 m|u /disk/diskXsX"
exit 1
fi
oper=$1
disk=$2
diskname=`basename $disk`
case $oper in
m)
mount_disk
;;
u)
umount_disk
;;
*)
echo "unknown operation"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment