When I tried to do it myself it put all 3 folders into the sub folder with 100 101 etc but looking at how you have coded it i can see where i went wrong !


Will let you know how i get on.
Moderator: DosItHelp
Code: Select all
@echo off
echo You're about to run the Archive and create batchfile!
pause
echo Please check to make sure no one is using the archive folder!
pause
pushd "C:\Testbegin" || goto :EOF
for /f "skip=10 delims=" %%a in ('dir *-* /b /o-n /ad') do (
robocopy "%%a" "C:\Testend\%%a" /move /e
)
pause
for /f "tokens=2 delims=-" %%a in ('dir *-* /b /on /ad') do set /a start=%%a + 1
set /a end=start + 49
for /L %%a in (%start%,1,%end%) do (
md "%start%-%end%\%%a"
md "%start%-%end%\%%a\cads"
md "%start%-%end%\%%a\production"
md "%start%-%end%\%%a\purchasing"
)
popd
peonowns wrote:I have added a way to try and stop accidental usage not sure if it is the best way.
I suppose a better way would be with commands for user input?Code: Select all
@echo off
echo You're about to run the Archive and create batchfile!
pause
echo Please check to make sure no one is using the archive folder!
pause
Code: Select all
@echo off
echo You're about to run the batchfile to Archive and create folders...
echo.
echo Please check to make sure no one is using the archive folder!
set "var="
set /p "var=type GO and press enter when you have done that: "
if not "%var%"=="GO" goto :EOF
Code: Select all
@echo off
echo You're about to run the batchfile to Archive Quotes...
echo.
echo Please check to make sure no one is using the archive folder!
set "var="
set /p "var=type GO and press enter when you have done that: "
if not "%var%"=="GO" goto :EOF
pushd "C:\Testbegin" || goto :EOF
for /f "skip=10 delims=" %%a in ('dir *-* /b /o-n /ad') do (
robocopy "%%a" "C:\Testend" /move /e
)