Reputation: 674
I have this piece of code which I made some time ago. It is a simple check to prompt the user to put in a different name if the folder name exists. For some reason it does not work. If the folder exists it should Goto AskForFolderName
. I cannot figure it out.
@echo off
@setlocal enableextensions enabledelayedexpansion
mode 90,10
color a
::Stage 3 - Check Folder
:AskForFolderName
set /p NewFolder=What is the name of the iteam being sold?
If ["%NewFolder%"]==[] Goto AskForFolderName
If Exist "%NewFolder%" (
Echo Folder already exists
Echo.
Goto AskForFolderName
)
Mkdir "003 - Images Ready\%NewFolder%"
Move "002 - Process Images\"*.* "003 - Images Ready\%NewFolder%"
ping 127.0.0.1 -n 20 > nul
exit
Upvotes: 0
Views: 77
Reputation:
Try this:
@echo off & setlocal enableextensions enabledelayedexpansion
mode 90,10
color a
::Stage 3 - Check Folder
:AskForFolderName
set /p "NewFolder=What is the name of the iteam being sold? "
If "%NewFolder%"=="" Goto :AskForFolderName
If Exist "003 - Images Ready\%NewFolder%\" (
Echo Folder already exists
Echo.
Goto AskForFolderName
)
Mkdir "003 - Images Ready\%NewFolder%"
Move "002 - Process Images\*.*" "003 - Images Ready\%NewFolder%"
Timeout /NoBreak /T 20 > nul
exit
Upvotes: 1