- Thread Author
- #1
Hi I made this batch code, to move all subfolders from "C:\1" to a new created folder inside folder "C:\2"
	
	
	
		
The code works fine, but I will run the command at regular intervals depending on the subfolders in "C:\1", so I need to check if the newly created folder name exists in the target location "C:\2", append sequential number to folder name.
Thanks
				
			
		Code:
	
	@echo off
  
set "sourceDir=C:\1"
set "destinationDir=C:\2"
set "newFolderName=NewSubfolder"
  
mkdir "%destinationDir%\%newFolderName%" 2nul
   
for /D %%I in ("%sourceDir%\*") do (
         move "%%I" "%destinationDir%\%newFolderName%\" )
   
pauseThe code works fine, but I will run the command at regular intervals depending on the subfolders in "C:\1", so I need to check if the newly created folder name exists in the target location "C:\2", append sequential number to folder name.
Thanks
 
 
		 
 
		