Is there a way with a batch file to instantly MOVE a file when it’s downloaded into Directory A into Directory B based on a variable in the file’s name?
I have a file naming convention that looks like this: Photo-87654321-1.jpeg
The 87654321 part is the variable. Now, with if statements and such, I can locate the directory, or if it doesn’t exist, create the directory and then place the image in there. The problems I’m having is: a) copying that variable string from the file name, b) running this script every time a file is moved into Directory A.
You haven’t given enough details about what you want to do with the file when you find the variable number, so I can only improvise.
This script will get the variable name from the files in
C:\DirectoryAand then move them into a folder with that name.This should give you enough details to tweak to your needs, but if you need anything more specific please provide more details.
Note: Given that you want to move files as soon as they are put in
DirectoryA, this is on an infinite loop, so you may want to watch your CPU.