A New Template for Joomla!


Script to record backup disk changes

This page has moved to the Wiki

@echo off

set driveletter=G
set working=C:\Scripts
set log=%working%\Backup-disk.log

set thedate=%date:Mon =%
set thedate=%thedate:Tue =%
set thedate=%thedate:Wed =%
set thedate=%thedate:Thu =%
set thedate=%thedate:Fri =%
set thedate=%thedate:~6,4%/%thedate:~3,2%/%thedate:~0,2%
set thetime=%time:~0,2%:%time:~3,2%:%time:~6,2%
set datestamp=%thedate:/=%%thetime::=%
set datestamp=%datestamp: =%

if not exist %driveletter%:\diskid2.txt echo %datestamp% > %driveletter%:\diskid2.txt

set /p diskid= %working%\lastdisk.txt
set /p lastdisk=> %log%

if %diskid%==%lastdisk% (
    echo %thedate% - %thetime% - Disk was not changed since last check >> %log%

if not %diskid%==%lastdisk% (
    echo %thedate% - %thetime% - The disk at drive letter %driveletter% was changed to: %diskid% >> %log%
    echo %diskid% > %working%\lastdisk.txt