Choosing selected files issue in PowerShell -


hi powershell experts,

i have few files in folder (folder a)with no extension (.file)

i have change few files content in folder this:

$configfiles=get-childitem . *. -rec  foreach ($file in $configfiles) {     (get-content $file.pspath) |      foreach-object {$_ -replace 'cig - prod cen', 'cig - eco gen'}|      set-content $file.pspath } 

cig - prod cen replaced cig - eco - gen, issue if so, replaced in files.

how can replacement selected files?

please can help?

you can filtering file while reading them:

$configfiles= get-childitem $folderlocation -recurse -include *.config 

now selected file type "config" , can suggested.

-or-

this did in scripts, check before change:

if ($file.fullname.substring($file.fullname.lastindexof('.')) -eq ".config") 

now - proceed .config files , move on other (good fixed list).

good luck :)


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -