Search

just show me the code

Friday, May 22, 2009

powershell rename recurse

get-Childitem C:\Root\Dev\Drycode\Source * -recurse | rename-item -newName { $_.Name -replace 'XTempNameX', 'DryCode' } -whatif

(Get-Content C:\Root\Dev\Drycode\Source\NNNNNNNNN.txt) |
Foreach-Object {$_ -replace "NNNNNNNNN", "@@@@@@@@@@@@@@@@"} |
Set-Content C:\Root\Dev\Drycode\Source\NNNNNNNNN.txt -whatif

NNNNNNNNN.txt
asNNNNNNNNNdfasdf
saNNNNNNNNNdf
v fsda
faNNNNNNNNNsd
wefwef
sdfasNNNNNNNNN
vdafdsafasfas
NNNNNNNNN
NNNNNNNNN.txt after
as@@@@@@@@@@@@@@@@dfasdf
sa@@@@@@@@@@@@@@@@df
v fsda
fa@@@@@@@@@@@@@@@@sd
wefwef
sdfas@@@@@@@@@@@@@@@@
vdafdsafasfas
@@@@@@@@@@@@@@@@



foreach ($file in get-Childitem -recurse)
{
$file.directoryName + " " +$file.name + " " +$file.length
}


get-Childitem *NNNN* | get-member -membertype property


helpful links
link1
link2
link3
link4
link5
link6

No comments:

Post a Comment

Contributors