Good afternoon Experts!
I have been trying to figure out a way to automatically move files to specific directories based on the names or "$_.lastwritetime.month" value of the files but am completely stuck due to variables. I hope that one of you could guide me in the right direction.
Let me explain the scenario:
We have a software that records all the phonecalls at our office and dumps them as mp3-files in a root directory once they are disconnected. The files are automatically named using a standard looking like: YYYYMMDD. What I would like to do is script an automated way to move these files to subdirectories once per night after office hours. There is currently around 100 GB of files that date back to 2010.
Let me pose an actual example:
a.) Let's say that we have our root directory: "F:\Finished Recordings\".
b.) Let us say that we have a file from last year: 20110510...mp3.
c.) Let us say that we have another file, this one from today: 20120824...mp3.
Based on the above I want the script to move the first file (b.) to "F:\Finished Recordings\2011\May\" and the second file (c.) to "F:\Finished Recordings\2012\August\".
The destination directories are allready created, so all I want is to move the files based on their first 6 numbers. Is there a clever way to acomplish this? Thank you!