Created
January 24, 2018 05:01
-
-
Save heisvoid/64bdc8a20613f3cc8a0d0ce141d06633 to your computer and use it in GitHub Desktop.
~/bin/move_cam_records.sh
This file contains hidden or 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
| 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