I’m trying to create a batch file that will accomplish the following:
(1) Create a folder “Inspections”, additionally, one with today’s date, and individual folders with addresses
(2) Copy and rename the file in “incoming” folder with date, address, sequence #
(3) Delete files in “incoming” folder
I’m stuck at the sequence numbering part. Output would look something like: 051424/555 Abc St/555 Abc St 001.jpg… 555 Abc St 002.jpg, etc
@echo off
if exist "%onedrive%"Desktopincoming*.jpg goto :proceed
if exist "%onedrive%"Desktopincoming*.jpeg goto :proceed
if exist "%onedrive%"Desktopincoming*.heic goto :proceed
echo .
echo .
echo ****************************************************************************
echo .
echo ******** No images found in "incoming" folder. ********
echo .
echo .****************************************************************************
echo .
echo .
pause
exit
:proceed
echo .
echo .
echo .
setlocal EnableDelayedExpansion
for /F "tokens=1 delims=/" %%m in ("%date:~4,2%") do (
set /A "m=(1%%m%%100-1)*3")
set month=JanFebMarAprMayJunJulAugSepOctNovDec
set monthName=!month:~%m%,3!
set /p custaddress1=Please enter address:
set workdate=%date:~4,2%%date:~7,2%%date:~12,4%
set workyear=%date:~10,4%
xcopy "%onedrive%"Desktopincoming*.jpg "%onedrive%"DesktopInspections%workdate%"%custaddress1%"%workdate%" ""%custaddress1%".*
xcopy "%onedrive%"Desktopincoming*.jpeg "%onedrive%"DesktopInspections%workdate%"%custaddress1%"%workdate%" ""%custaddress1%".*
xcopy "%onedrive%"Desktopincoming*.heic "%onedrive%"DesktopInspections%workdate%"%custaddress1%"%workdate%" ""%custaddress1%".*```
David is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.