Skip to content

Instantly share code, notes, and snippets.

@oe7drt
Created September 1, 2019 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oe7drt/40b97e22d08d74641e30f895e8829c2d to your computer and use it in GitHub Desktop.
Save oe7drt/40b97e22d08d74641e30f895e8829c2d to your computer and use it in GitHub Desktop.
Mount and move media files from sdcard
#!/bin/bash
# Note: a proper setup in /etc/fstab is necessary!
c=0
echo -en "Mounting sdcard..."
sudo mount -o uid=1000,gid=1000 /mnt/sdcard
echo -en " done\n"
files=$(ls /mnt/sdcard/DCOM/100CANON/MVI*.MP4 | wc -l)
for file in /mnt/sdcard/DCIM/100CANON/MVI*.MP4; do
echo -en "Moving file '$(basename $file)'..."
mv -f $file ~/nice_movs/
echo -en " done\n"
(( ++c ))
echo -en " Moved file $c of $files\n\n"
done
echo -en "Moved $c files.\n"
echo -en "Unmounting /mnt/sdcard..."
sudo umount /mnt/sdcard
echo -en " done\n"
# vim: set syntax=sh ft=sh ts=2 sw=2 tw=0 et :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment