Skip to content

Instantly share code, notes, and snippets.

@heisvoid
Created January 24, 2018 05:01
~/bin/move_cam_records.sh
i=0
for f in `/usr/bin/ls -1 -r /mnt/disk0/cam0/rec/*.mp4 2>/dev/null`
do
# Skip the latest file
if [ 0 -eq $i ]
then
i=1
continue
fi
tmp=`echo "$f" | /usr/bin/cut -d "D" -f 2 2>/dev/null`
d=`echo "$tmp" | /usr/bin/cut -d "T" -f 1 2>/dev/null`
t=`echo "$tmp" | /usr/bin/cut -d "T" -f 2 | /usr/bin/cut -d "-" -f 1 2>/dev/null`
dir="/mnt/disk0/cam0/rec/$d/$t"
/usr/bin/mkdir -p "$dir"
/usr/bin/mv "$f" "$dir/" </dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment