Rename files recursively
hi expert,
i having hard time renaming files within subfolders, have script:
get-childitem -recurse | {$_.name -match "^(_2014-|2014-)"} | % { rename-item $_ "_000000$($_.name)"}
it rename files on current folder in subfolders keeps throwing error;
rename-item : cannot rename because item @ filename does not exist. appreciated
regards
here again:
get-childitem -recurse -file -include '2014*','_2014*' | foreach-object{ rename-item $_.fullname ('{0}\_000000{1}' -f $_.directory.fullname,$_.name) }watch out ther no whatif time.
¯\_(ツ)_/¯
Windows Server > Windows PowerShell
Comments
Post a Comment