Sander Tuulik AK41

From ICO wiki
Revision as of 21:24, 30 January 2011 by Stuulik (talk | contribs)
Jump to navigationJump to search

Ülessanne

Loo skript, mis leiab etteantud kataloogist või kettalt samanimelised failid ja väljastab nende nimekirja.

Skript

$op_file = $args[0]
if (! $op_file) {
$op_file = Read-Host "Millisest kataloogist otsida samanimelisi faile?"
}
Write-Host "Samanimelisi faile otsiti kataloogist: $op_file"
$Dir = get-childitem $op_file -recurse 
$List = $Dir 
$dir1 = $list | group | ? {$_.count -gt 1}| % {$_.group} 
echo ""
if(!$dir1){Write-Host "Samanimelisi faile polnud kataloogis: $op_file"}
$dir1 | format-table -a fullname