Wednesday, September 24, 2014

Move a file into a directory of the same name

The need arose recently at $work that required a script to search a directory for all PST files, create a directory with the same name of each file (excluding the file extension) and move that file into the directory of the same name.

This was accomplished using  powershell:

get-childitem . *.pst | `

new-item -type directory $cur
move-item $ $cur

No comments:

Post a Comment