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... Rivera.pdf
Jacobs.pdf
Knoblauch.pdfI need the .bat file to then put those files into their own folder
Rivera 1234
Jacobs 2345
Knoblauch 3456I 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.
@echo offREM 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"
)REM Complete
echo Done
echo.
I found this code online and don't know how to completely decipher it so any help with that is also appreciated.
The million dollar question is: where are the ssns coming from? The rest seems fairly straighforward. If they are in a spreadsheet or database, they could be exported to text. Probably from PDF as well.
The SSN's will be coming from a database
which I've exported into an excel file
Ok, but batch can't do excel, it would have to be exported to text for batch to have access to that information. If you decide to go that route, please post a sample of the output (text export, with obfuscated data, of course. no real names or ssns.)
Two or three lines would be sufficient.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |