New
#21
Slightly improved code . . .
This batch script creates a folder for each filename in the directory that the batch script resides in and then populates [ moves ] them with the files accordingly. The folders names will be a mirror image of the filenames themselves, excluding the suffix.
WARNING: Setup a test directory directory that includes a selection of filenames FIRST and then run the batch script to ensure that the results are correct and as expected.
Code:@echo off title Files To Folders - Written by Paul Black. mode con: cols=60 lines=7 & color 17 set count=-1 echo. & echo Processing . . . for %%j in (*) do set /A Count +=1 for %%i in (*) do ( if not "%%~ni" == "Files_To_Folders" ( md "%%~ni" && move "%%~i" "%%~ni" >nul ) ) echo. & echo Created and populated %Count% folders successfully! echo. & echo ^>Press ANY key to EXIT . . . & pause >nul
Last edited by Paul Black; 03 Jul 2020 at 12:10.
Good morning Paul. It's 7:30 AM and having my morning coffee. I ran a side by side comparison of the two codes and the only change I see is the blue CMD. Slightly Improved
- - - Updated - - -
And what dose this change of code do exactly? See the image.
Hello @Lance1,
WARNING: Setup a test directory that includes a selection of suffixes FIRST and then run the batch script to ensure that the results are correct and as expected.
Here is the file => Code moved further down the thread.
Please let me know how you get on!
Last edited by Paul Black; 03 Jul 2020 at 12:40.