21
3
I want to scan a directory (there are no subs) and delete any file with an extension of .avi I tried this syntax, but no errors are thrown, and no files are deleted. This is the code I tried
get-childitem 'C:\Users\ramrod\Desktop\Firefly' -include *.avi | foreach ($_) {remove-item $_.fullname}
What should be altered in order to delete all the .avi files from the folder?
3What prevents you from using
rm *.avi? (Yes, that's valid PowerShell syntax becausermis an alias ofdel. – GiantTree – 2016-06-20T12:08:54.8802Technically,
rmanddelare both aliases of theRemove-Itemcmdlet. – root – 2016-06-21T14:33:59.420