Created
September 1, 2019 15:16
-
-
Save oe7drt/40b97e22d08d74641e30f895e8829c2d to your computer and use it in GitHub Desktop.
Mount and move media files from sdcard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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