|Ok so here is the scenario. I have many pdf files where each file corresponds to 1 person. I need to move these files into a unique folder for each person. This Folder will be titled "Last Name (Last 4 Digits of SSN)". So here is how the folder looks now...|
I need the .bat file to then put those files into their own folder
I know somewhere I'm going to need an sql statement to place the file within the correct folder. My code now creates folders with the same name as the pdf file.
REM Loop through every file in this folder
REM Excluding this batch file!
for /f "delims=" %%A in ( ' dir /b /a-d ^| find /v "%~nx0" ' ) do (
REM If a folder with the same base name
REM does not exist, create it
if not exist "%%~nA" md "%%~nA"
REM Move the file into the folder
REM and show message to user
echo Moving file: %%A to folder: %%~nA
move "%%A" "%%~nA"
I found this code online and don't know how to completely decipher it so any help with that is also appreciated.