Last active
September 28, 2023 16:46
-
-
Save typoman/2131c9702ba7f74d29eedd632528dc46 to your computer and use it in GitHub Desktop.
Backup proxy of images and videos
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 | |
# Use this if you want to make a copy of your images and viodes with | |
# siginficant reduced size. This bash script duplicates the folder structure | |
# of all the sub folders underneath the current folder, and puts images and | |
# videos there. It also redcues the size of images and creates screenshots of | |
# videos instead of copying the resized video. Run it inside the folder that | |
# contains all your images, it will create another folder next to it and put | |
# the images and videos with reduced size there. | |
# - To make it executbale in terminal and same folder and run | |
# `chmod +x current_file_name.sh` | |
# - To excecue: ./current_file_name.sh | |
find * -type d -exec echo MKDIR {} \; -exec mkdir -p -- ../backup_images/{} \; | |
find -E * -iregex '.*\.(gif|jpg|jpeg|tiff|png)' -type f -exec echo RESIZE IMAGE {} \; -exec convert {} -resize 640X480 -quality 60 ../backup_images/{} \; | |
find -E * -iregex '.*\.(mkv|webm|flv|ogg|avi|mov|qt|wmv|mp4|m4v|mp|svi|3gp|flv|f4v)' -type f -exec echo VIDEO THUMBNAIL {} \; -exec ffmpeg -loglevel warning -ss 00:00:1 -i {} -vf select='not(mod(n\,400))',scale=300:-1,tile -frames:v 1 ../backup_images/{}.jpg \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need ffmpeg and imagemagick for this script to work.