Last active
January 27, 2017 12:36
-
-
Save vadimshvetsov/4239abe765613db8ec7e109c6eb0f6ba to your computer and use it in GitHub Desktop.
Script for copy datetime from original MOV/MP4 file to compressed.
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 | |
# Get all files with uppercase MP4 and MOV | |
files='*.MP4 *.MOV'; | |
# Go through files | |
for f in $files; | |
do | |
# Create a regexp for find compressed file | |
regexp=$(echo $f | sed -e "s/\(.*\)\(\.\)\(...\)/\1\*.\L\3/"| tr -d '\n'); | |
# Find compressed file | |
compressed=$(echo $regexp); | |
# If file exists | |
if [ -f "$compressed" ] | |
then | |
echo "File $f is updated" | |
# Modify with original date & time | |
touch -r $f $compressed | |
# Remove original file and rename compressed | |
mv $compressed $f | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment