Currently, I'm using the following command to output filenames to a text file:
( Get-ChildItem -File ).BaseName | Out-File "Track List.txt" -Encoding utf8
How can I limit the filenames to a specific extension, e.g., .mp3?
CodePudding user response:
The -Filter paramater accepts wildecards - ? for any single character, and * for zero or more matches
( Get-ChildItem -File -Filter *.mp3).BaseName | Out-File "Track List.txt" -Encoding utf8
See the Powershell documentaiton on -Filter and wildcards for more information [wildcards]: