SFTP Video Surveillance Script Example

Tips and Tricks for video surveillance systems and cameras

Moderator: michaelr

Post Reply
User avatar
support
Posts: 46
Joined: Wed May 07, 2014 7:09 am

SFTP Video Surveillance Script Example

Post by support »

C-MOR V5 offers an SFTP interface to download Video Surveillance Recordings. Recordings can be manually downloade or by script.

This example shows how to download recordings with PSFTP from the Putty SSH Client package:

Code: Select all

# C-MOR Download Example Script
# PSFTP is required to use this script. Download and install putty to get the psftp program
# Source: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
#
# Important!
# Important: Connect to C-MOR once manually via psftp to store the SSH key on your PC
# Important!
#
""
"Start C-MOR.COM Download via PSFTP" 
""
""
############### Example Download all Recordings from Today ###################
# $today=Get-Date
# $year=$today.Year
# $month=$today.Month.ToString("00");
# $day=$today.Day.ToString("00");
# $filelist="$Year$Month$Day*"
############### Example Download all Recordings from Yesterday ###################
$yesterday=(Get-Date).AddDays(-1)
$year=$yesterday.Year
$month=$yesterday.Month.ToString("00");
$day=$yesterday.Day.ToString("00");
$filelist="$Year$Month$Day*"

# "Filelist: " 

# Create to correct ANSI File type to be processed by psftp
Out-File 'batch.txt' -Encoding Ascii

# Example: Download all files from cam1 to local directory "videos"
"lcd videos" | out-file -append batch.txt  -Encoding Ascii
"mget cam1/$filelist" | out-file -append batch.txt  -Encoding Ascii

# IP Address of the C-MOR
$cmor="192.168.1.2"
# Get Videos
psftp $cmor -P 9442 -l download -pw password -b batch.txt

# clean up
del batch.txt

Post Reply