Photo by Elsa Noblet on Unsplash
powershell command (cp, list, rename, find, count)
Windows/power-shell-basic
- outline
basic command for Windows Power Shell
- example
List of files ending with txt
Get-ChildItem *txtSave list of files ending with wav to wavlist.txt
Get-ChildItem -filter *wav > wavlist.txt
Change file name
Change file name ending with txt to file name ending with log
Get-ChildItem *txt | Rename-Item -NewName { $_.Name -Replace 'txt', 'wav'}count files ending with json
(Get-ChildItem -filter *json | Measure-Object).CountNumber of files in current folder
(Get-ChildItem -Recurse -File | Measure-Object).CountNumber of files ending with .mp3
Get-ChildItem "." -Filter *.mp3 -Recurse | Measure-ObjectRemoving files ending with .ogg
Get-ChildItem "." -Filter *.ogg -Recurse | Remove-ItemRemoving files ending with .ogg with force option
Get-ChildItem "." -Filter *.ogg -Recurse | Remove-Item -force
- reference