Monday, June 11, 2012

Rename and Move Files with Powershell

I have a software program that will import pictures into its database. Unfortunately it cannot accept files with the same name nor can it distinguish files from each other based off on what is in the file. It does however, index these files based on the file name.

If any of you have worked with a Sharp multi-function device, you might know that when  a person scans a document to a file, it is given a random name based off criteria you select. The criteria available is limited and I needed more precise file names so that the software could index properly.

Here is what i did. I set up different "Scan to network" locations based off the file name needed. For example, Credit Card receipts would have it's own address book button, and send it to a folder called CCR inside of a network share. I would then have a script ran every so often that would move it to the right folder based off its location so the Software could import it. Here is my script:



This will take all items in e:\import\ccr and then move them to e:\import_complete along with a completely different name. The $random variable is there so files will not have the same exact name. The software can then import them with the right indexes

No comments:

Post a Comment