Copy and rename videos from a directory
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 | |
# | |
# Copy and Rename Videos | |
# Created by : Ralph Crisostomo - 2016/09/10 | |
# | |
# ./copy_rename_videos.sh /source/dir /destination/dir | |
# | |
SOURCE_DIR="$1" | |
VIDEO_DIR="$2" | |
COUNTER=0000 | |
find -E "$SOURCE_DIR" -iregex '.*\.(mts|mov|mp4|mkv)' | while read -r LINE | |
do | |
COUNTER=$[$COUNTER +1] | |
EXT="${LINE##*.}" | |
EXT=$(echo $EXT | tr "[:upper:]" "[:lower:]") | |
NEW_FILE=$(printf "%05d.$EXT\n" $COUNTER) | |
cp -v "$LINE" "$VIDEO_DIR/$NEW_FILE" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment