Skip to content

Instantly share code, notes, and snippets.

@francisoud
Last active April 4, 2016 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francisoud/0eeee68bf3528dbf7845d9b1b6b7f8a6 to your computer and use it in GitHub Desktop.
Save francisoud/0eeee68bf3528dbf7845d9b1b6b7f8a6 to your computer and use it in GitHub Desktop.
Rename extension that M$ OneDrive Enterprise doesn't like :(
Function Rename-Files($path)
{
Get-ChildItem -path $path |
Foreach-Object {
if($_ -is [System.IO.DirectoryInfo]) {
# echo "directory: $_"
Rename-Files -path $_.FullName
} else {
# replace with exetension .swf, etc.
$newName = $_.name -replace '\.jar', '.jar.rename'
if (-not ($_.name -eq $newname)){
echo "renaming: $_.fullname to: $newName"
Rename-Item -Path $_.fullname -newname ($newName)
}
}
}
} #end function
# replace <my_user> (todo use %USERPROFILE%) and <ENTERPRISE>
Rename-Files -path "C:\Users\<my_user>\OneDrive - <ENTERPRISE>\"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment