Fancy Filename Footwork

Ever wanted to take a list of files and turn it into a list of folders? Maybe even with said file inside the newly created folder?

Probably not, but in case you ever have, read on….

I recently had a slew of paper files scanned and wanted to archive them on a shared network drive on our Windows server. The scans we received were PDF files and named according to the company name that appeared on the paper folder’s tab. ABC.pdf, BMF.pdf, CNN.pdf, XYZ.pdf and so on. Wonderful stuff— indexed, OCR’d and fully searchable.

Shift + Right-ClickBut what if you need to add new stuff?

Instead of just plopping the PDFs on the server we decided that each company should have their own folder. Then any new paperwork could be scanned and added to their folder. The first file we would place in each folder would be the recently scanned archive files. Simple enough.

But wait! The idea of manually creating 1500 new folders on our Windows server did not excite me. Then I found a simple script that works from a command prompt. If you shift+right-click the folder in question you can choose “Open a Command Window Here” and execute this command:

for %i in (*) do md "%~ni" && move "%~i" "%~ni"

In a minute you’ll have a list of folders with names that correspond to the files, and each file will be in its respective folder!

Use at your own risk, your mileage may vary, not responsible for any problems resulting from use of these handy tips.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s