We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Dealing with large number of files on a USB drive, Windows is too slow

Options
I am trying to tidy up a folder of files on a USB hard drive. Have about 30,000 files to delete within the folder before I transfer the remainder to another drive.

Windows File Explorer can find the files based on a search criteria within 30 seconds. But the moment I try to select a large range of these or ctrl-A for all, it goes into a funk. I can see it will take hours based on the ongoing count in bottom corner.

I'd be curious to know if there are other point and click utilities that can say, select out all files under 5k bytes in size and then delete them within a folder structure.

Comments

  • Mr_Toad
    Mr_Toad Posts: 2,462 Forumite
    buglawton wrote: »
    I am trying to tidy up a folder of files on a USB hard drive. Have about 30,000 files to delete within the folder before I transfer the remainder to another drive.

    Windows File Explorer can find the files based on a search criteria within 30 seconds. But the moment I try to select a large range of these or ctrl-A for all, it goes into a funk. I can see it will take hours based on the ongoing count in bottom corner.

    I'd be curious to know if there are other point and click utilities that can say, select out all files under 5k bytes in size and then delete them within a folder structure.

    are they media or image files of some sort or other?

    If so this can cause the problem you have as if memory serves me, I could be wrong as it's been a while, explorer creates thumbnail images in the background even if you have no intention of displaying them.

    For this reason I'd do this from the cmd line in terminal or create a batch file to do it.

    I have no idea about other graphical programs.
    One by one the penguins are slowly stealing my sanity.
  • buglawton
    buglawton Posts: 9,246 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    edited 16 April 2015 at 12:28AM
    Exactly, Explorer created a 4k byte file for each JPEG. Now you mention it, I recall there's a way to tell Windows to put these in a separate cache folder. More research needed methinks. If the tiny files are not persistent on the usb drive then a Simple DOS copy would do it.
  • Strider590
    Strider590 Posts: 11,874 Forumite
    edited 16 April 2015 at 12:42AM
    Lets get this straight, you want to delete files below a given size?

    Pop this in a batch file:

    for /f "usebackq delims=;" %%F in (`dir /s /b *.jpg`) do If %%~zF LSS 9500 del /q "%%F"

    9500 = 9.5KB
    jpg = file type

    Create a new line for each file type and change jpg to the desired file type.

    You'll need to add random text to the end of the file in order to stop it deleting itself (IMPORTANT!!).

    Pop the file in the directory in which the files/folders are located and then run the file. It will delete any and all files below the defined file size, in the current directory and all sub-directories.
    “I may not agree with you, but I will defend to the death your right to make an a** of yourself.”

    <><><><><><><><><<><><><><><><><><><><><><> Don't forget to like and subscribe \/ \/ \/
  • Mr_Toad
    Mr_Toad Posts: 2,462 Forumite
    Strider590 wrote: »
    Lets get this straight, you want to delete files below a given size?

    Pop this in a batch file:

    for /f "usebackq delims=;" %%F in (`dir /s /b *.jpg`) do If %%~zF LSS 9500 del /q "%%F"

    9500 = 9.5KB
    jpg = file type

    Create a new line for each file type and change jpg to the desired file type.

    You'll need to add random text to the end of the file in order to stop it deleting itself (IMPORTANT!!).

    Pop the file in the directory in which the files/folders are located and then run the file. It will delete any and all files below the defined file size, in the current directory and all sub-directories.

    That's the one.

    I knew someone would be along who knew the syntax :T

    I couldn't remember how last night without looking it up and I was tired :o
    One by one the penguins are slowly stealing my sanity.
  • prowla
    prowla Posts: 13,971 Forumite
    Part of the Furniture 10,000 Posts Name Dropper
    You could copy out the files you want, and then re-format the drive.
  • Strider590
    Strider590 Posts: 11,874 Forumite
    edited 16 April 2015 at 8:17AM
    Mr_Toad wrote: »
    That's the one.

    I knew someone would be along who knew the syntax :T

    I couldn't remember how last night without looking it up and I was tired :o


    It took me ages to come up with that, it appears in a couple of online forums, but needed some tweaking to get it working properly.

    About 2 weeks ago I wrote it in as part of a large batch file that's responsible for running my CCTV webcam (movement sensitive time lapse), I needed something that would delete all the blank images (everything under 9.5KB) before making the automatic evening backup to my NAS, as these blank images were taking up near 10GB of space!!! :(
    “I may not agree with you, but I will defend to the death your right to make an a** of yourself.”

    <><><><><><><><><<><><><><><><><><><><><><> Don't forget to like and subscribe \/ \/ \/
  • John_Gray
    John_Gray Posts: 5,843 Forumite
    Part of the Furniture 1,000 Posts Name Dropper Photogenic
    My only criticism of the BATch file line is that "usebackq" is unnecessary, and the ` (back quote) characters can be replaced by the normal ' (single quote) characters!
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.