Last active
April 4, 2016 08:52
-
-
Save francisoud/0eeee68bf3528dbf7845d9b1b6b7f8a6 to your computer and use it in GitHub Desktop.
Rename extension that M$ OneDrive Enterprise doesn't like :(
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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