windows:powershell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
windows:powershell [2022/02/18 10:15] adminwindows:powershell [2022/09/21 07:22] (current) admin
Line 6: Line 6:
 </code> </code>
   * example <https://devblogs.microsoft.com/scripting/powertip-find-if-variable-is-array/>   * example <https://devblogs.microsoft.com/scripting/powertip-find-if-variable-is-array/>
 +
 +<code powrshell>
 +# список файлов - list files powershell
 + $filter= "avi"
 + $source="K:\Остеопатия\массаж"
 + $destination ="D:\Films\massage"
 + set-location $source
 +
 + $source_regex = [regex]::escape($source)
 + (Get-ChildItem $source -recurse | where {-not ($_.psiscontainer)} | select -expand fullname)  -match $filter |
 +         foreach { 
 +          $file_name = ($_ | split-path -leaf)
 +          $file_name_withoutextension =  [System.IO.Path]::GetFileNameWithoutExtension($file_name)
 +          $file_destination = $destination + '\' + $file_name_withoutextension
 +          $file_dest = ($_ | split-path -parent) -replace $source_regex,$file_destination
 +
 +          #if (-not (test-path $file_dest)){mkdir $file_dest}
 +           #copy-item $_ -Destination $file_dest
 +            #Write-Output -InputObject
 +             $_
 +             #($_.Split("\"))
 +             #| Select-Object -Property Length
 +        }
 +</code>
 +
 +<code bash>
 +# put files in list
 +Get-ChildItem -Recurse -Include *.pdf| Format-Table name -hidetableheaders | Out-File 'pdf list.txt'
 +</code>
  
  • windows/powershell.1645179321.txt.gz
  • Last modified: 2022/02/18 10:15
  • by admin