我有一個腳本在不同位置的3臺服務器上運行,每天晚上使用YYYY MM DD
將JPG移動到一個文件夾,即今天捕獲的圖像將在23:55移動到名爲2014的文件夾,稱爲12的子文件夾,子文件夾名爲31.如何從月份得到月份的簡稱?
但是,我想將月份設置爲Dec而不是。
我使用的腳本是:
@ECHO OFF
CLS
e:
cd \webcam\webadminpan
ECHO Checking For any JPG Files
DIR /b *.jpg > NUL 2>&1
IF ERRORLEVEL 1 GOTO NoFilesFound
ECHO Found Files To Move
SET thisyear=%date:~6,4%
echo I am this year : %thisyear%
SET thismonth=%date:~3,2%
echo I am this month : %thismonth%
SET thisday=%date:~0,2%
echo I am this day : %thisday%
:CheckYearCreate
ECHO Checking to see if year directory %thisyear% exists
DIR /b "%thisyear%"> NUL 2>&1
IF ERRORLEVEL 1 GOTO CreateYear
ECHO Directory %thisyear% must already be present
:CheckMonthCreate
ECHO Checking to see if month directory %thismonth% exists
DIR /b "%thisyear%\%thismonth%"> NUL 2>&1
IF ERRORLEVEL 1 GOTO CreateMonth
ECHO Directory %thisyear%/%thismonth% must already be present
:CheckDayCreate
ECHO Checking to see if day directory %thisday% exists
DIR /b "%thisyear%\%thismonth%\%thisday%"> NUL 2>&1
IF ERRORLEVEL 1 GOTO CreateDay
ECHO Directory %thisyear%/%thismonth%/%thisday% must already be present
:MoveJPGFiles
ECHO Moving JPG Files To "%thisyear%/%thismonth%/%thisday%"
MOVE *.jpg "%thisyear%\%thismonth%\%thisday%"
GOTO TheEnd
:CreateYear
ECHO Making Year %thisyear% Directory
MKDIR "e:\webcam\webadminpan\%thisyear%"
GOTO CheckYearCreate
:CreateMonth
ECHO Making Month %thismonth% Directory
MKDIR "e:\webcam\webadminpan\%thisyear%\%thismonth%"
GOTO CheckMonthCreate
:CreateDay
ECHO Making Day %thisday% Directory
MKDIR "e:\webcam\webadminpan\%thisyear%\%thismonth%\%thisday%"
GOTO CheckDayCreate
:NoFilesFound
ECHO Nothing to Move
:TheEnd
ECHO Finished
Exit /b 0
任何人都可以對我怎麼能做到這一點,並得到thismonth
組與短縮寫,而不是數量的建議?