Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
windows powershell to delete files
I want a windows powerschell script to delete all files with names ending with _1.
Microsoft Legacy OS
8/22/2022 - Mon
Try something like this
PS C:\temp> remove-item * -include *_1.*
Where do i run this command.
I run it in cmd.
I get error:
'Remove-Item' is not recognized as an internal or external command,
operable program or batch file.
You need to run it in powershell. Click start and in the search box, type powershell.
Another example with folder name: remove-item c:\Temp\* -include *_1.*
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Incidently the script didn't do anything
Remove-Item -path "C:\Users\Me\Pictures" -include *_1.*
Remove-Item -path 'C:\Users\Me\Pictures' -include *_1.*
Remove-Item C:\Users\Me\Pictures\* -include *_1.*
First of all i would want to see what file windows is selecting to delete, and then delete them
to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
If you have a space in your username then follow this example.
PS C:\> remove-item "C:\Temp\New Folder\*" -include *_1.*
You could just create a test folder and add a few files like I did in my example.
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent