Sunday 10 February 2019

Rename files to guid

Let's say you wanted to rename all the files within a directory to GUID's why? who know maybe you just do, well the following powershell will get you there

Dir -filter *.docx| %{Rename-Item $_ -NewName ("{0}.docx" -f [guid]::NewGuid())}

get me all the files with a docx extension, then for each one of them give it a new name preserving the extension but changing the name into a guid