@echo off
REM ************************************
REM Camera archiving per date
REM This file will create a folder structure based on the day of the month
REM that this file is run. Under the C:\CAMERA folder there will be one subfolder
REM ranging from 1-31, representing the day of the month the camera images
REM were recorded. After that, folders for each camera are made. Lastly, the images
REM from each camera are moved from the FTP location to the appropriate camera
REM folder under the correct date. Then, during the following month, the previous
REM month's images are deleted before archival of the current day's images is done
REM to prevent keeping old images that are not needed
REM ************************************
cls
REM ************************************
REM Set environment variable to determine the current date
REM Used to create subfolders to organize files for each camera
REM ************************************
for /f "tokens=1-3 delims=/ " %%i in ('date /t') do set today=%%k
REM ************************************
REM Deletes last month's pictures
REM ************************************
del d:\cameras\%today%\cam1\*.* /q
del d:\cameras\%today%\cam2\*.* /q
del d:\cameras\%today%\cam3\*.* /q
REM ************************************
REM Create subfolders under C:\Camera folder for archival storage
REM One folder per camera, all under a 2-digit numbered folder representing the day
REM of the month the pictures were taken
REM ************************************
md d:\cameras\%today%\cam1
md d:\cameras\%today%\cam2
md d:\cameras\%today%\cam3
REM ************************************
REM Move pictures from FTP to the appropriate subfolder per camera
REM ************************************
move /y d:\ftp\cam1\*.* d:\cameras\%today%\cam1
move /y d:\ftp\cam2\*.* d:\cameras\%today%\cam2
move /y d:\ftp\cam3\*.* d:\cameras\%today%\cam3