I need to move files from a directory to another directory based on the files name. The files are in the format of 12345 123456.pdf
where the 2 string lengths can vary. There will always be a space between them though and they are always PDF files.
The destination directory is the SAME NAME as the first string of the filename (ex. 10003075 3000101012.pdf
destination directory would be 10003075
).
If the destination directory does not exist I DO NOT want it created. The file should be left in the initial directory.
The file structure is as such:
Main Folder
|
Destination Directories
Files waiting to be moved Directory
|
Batch file
So the Batch file would have to check the directory it is in for pdf files, then check the directory above it for the directory corresponding to the first string in the file name, then move that file to that directory only if it exists else leave the file where it is.
I have worked with some suggestions on stackoverflow but everything I have seen will either make the directory or move the file to the main directory if the directory is not there.