1

I have a folder with 30,000 images files. I'm trying to delete the first 5000 or so. If I highlight the first 5000, and then try Shift + Delete, I only get the option to send to the Recycle Bin, which is already slow and will later require me to empty the Recycle Bin.

I was wondering if there is a way to do this via command prompt. I want to get rid of 5000 to 10,000 images out of 30,000, all located in one folder, and I do not really care about which images.

  • Shift + Delete will allow immediate deletion... not sure why it isn't working in your case. – Brad Feb 26 '18 at 0:18
4

You can use PowerShell!

gci | ? { -not $_.PSIsContainer } | select -First 5000 | del

This permanently deletes an arbitrary 5000 files from the current directory. After launching PowerShell (Windows+R, powershell), you should use cd to the folder containing the images, then run the command. If you want to change the number of files deleted, change the number 5000.

Explanation:

  • gci gets the items in the current directory
  • ? { -not $_.PSIsContainer } filters the items down to those that are not folders
  • select -First 5000 takes the first 5000 of the items still in the pipeline
  • del deletes the items it receives from the pipeline
  • Haven't tested it out yet, but looks to fit my needs. Thank you for breaking down the commands as well. – moondra Feb 26 '18 at 0:36
-3

Temporary you can disable the recycle bin on the selected drive. In this case the file deletion speed significantly faster.

If you provide more details (which files want you keep etc) then easy to write a batch file, and we should help to make it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.