We have a network folder used as a holding area for XML files that were not properly processed. I’ve been asked to design a script that runs every five minutes and checks the folder for any files less than five minutes old. If it finds files less than five minutes old, it moves them into another directory to be processed.
The trick is, we only want it to move the files one time. If they fail a second time, they will be thrown back into that folder and need to remain there to be dealt with later.
The file names each contain a unique time and date stamp as part of the file name. It’s a little convoluted, but the format is:
YYYYMMDDHHmmSSSSS
I was thinking there might be a way for PowerShell to look at the “mm” stamp of the filename and compare it to the current time. If it’s less than five minutes old, it moves it. If it’s greater than five minutes old, it leaves it alone.
Is this possible?