IMS - qkuro - Backing up files
The code snippets shown below are for demonstration purposes only and should only be used by qualified personnel. (Microsoft Windows Vista - see note below.)The qkuro contains four files which determine the pages shown on the Web pages and the data sent over ftp and shown in the Energy Profile.
dir.txt a directory listing read only
clone.icf the IP configuration read/write
log.csv the entire datalog file read only
webpages.fat all the individual read/write
webpages as one file
Access to the files is through tftpi and a command can be carried out by creating a single line file with a .bat extension. Vista users will have to ensure that the tftp, which is always included as a standard feature, is enabled.
tftp -i 192.168.1.127 GET dir.txt dir.txtThis will GET the clone file from a qkuro with an IP address of 192.168.1.127 and create a read only file in the same directory called clone.icf. (Tftp uses port 69 so can normally only be used locally thus preventing any unauthorised remote access to these files. The port can be deliberately opened with port forwarding or a DMZ.) Adding pause to the file then enables you to check that the command completed successfully before acknowledging it and closing the command window.
tftp -i 192.168.1.127 GET dir.txt dir.txt pauseAll four files can be saved by including the four tftp GET commands in one file.
tftp -i 192.168.1.127 GET dir.txt dir.txt tftp -i 192.168.1.127 GET log.csv log.csv tftp -i 192.168.1.127 GET webpages.fat webpages.fat tftp -i 192.168.1.127 GET clone.icf clone.icf pauseAs the files are read only this will not normally overwrite earlier files.
Advanced
The sample code shown below creates file names which include the IP address and the local time and date. This enables better records to be maintained and files are unlikely to be overwritten.
set WP_defaultIP=192.168.1.127
for /F "tokens=1-4 delims=/:., " %%a in ('date/T') do set f_name=%%c%%b%%a
for /F "tokens=1-2 delims=:., " %%a in ('time/T') do set f_name=%f_name%_%%a%%b
tftp -i %WP_defaultIP% GET dir.txt __%WP_defaultIP%_%f_name%_dir.txt
rem notepad __%WP_defaultIP%_%f_name%_dir.txt
for /F "tokens=1-4 delims=/:., " %%a in ('date/T') do set f_name=%%c%%b%%a
for /F "tokens=1-2 delims=:., " %%a in ('time/T') do set f_name=%f_name%_%%a%%b
tftp -i %WP_defaultIP% GET clone.icf __%WP_defaultIP%_%f_name%_clone.icf
copy __%WP_defaultIP%_%f_name%_clone.icf __%WP_defaultIP%_clone.icf
rem notepad __%WP_defaultIP%_%f_name%_clone.icf
for /F "tokens=1-4 delims=/:., " %%a in ('date/T') do set f_name=%%c%%b%%a
for /F "tokens=1-2 delims=:., " %%a in ('time/T') do set f_name=%f_name%_%%a%%b
tftp -i %WP_defaultIP% GET log.csv __%WP_defaultIP%_%f_name%_log.csv
rem notepad __%WP_defaultIP%_%f_name%_log.csv
for /F "tokens=1-4 delims=/:., " %%a in ('date/T') do set f_name=%%c%%b%%a
for /F "tokens=1-2 delims=:., " %%a in ('time/T') do set f_name=%f_name%_%%a%%b
tftp -i %WP_defaultIP% GET webpages.fat __%WP_defaultIP%_%f_name%_webpages.fat
rem notepad __%WP_defaultIP%_%f_name%_webpages.fat
pause
Note.
Microsoft Windows Vista.
tftp may need to be enabled - see http://windowshelp.microsoft.com/Windows/en-US/Help/1e62706b-ef53-4ecd-a217-0e7bcf82009b1033.mspx
