How to Delete Many Files Selectively

Or, How to Save Loads of Time – a salutatory tale of back-ups, restores, and being cross with oneself for not reading instructions on the website carefully.

caution: be sure to read the last sectionBe careful if you try this. Before trying this, read the last section, even if you skip through the rest.

Why I Need to Delete Many Files

When you make websites, you amass a lot of files and you need to take care of them.

I have a new security system where I back-up all my websites – and everything else for that matter. It’s a 1TB Seagate Backup Plus external drive. It has its own back-up software, which works fine. However, I thought it wise to test file restore before needing it in anger.

There is no instruction book, but there’s help on their website, and 4MB of PDF user manual. Naturally I read it all 🙂

To test the restore mechanism (you should always test your back-ups – too late to find it isn’t working when you’ve lost your hard disc!) I decided to restore one file. That must be easy enough! I followed my nose and restored all the files on my C: drive except the selected one! Not only that, but I’d selected the “don’t overwrite” option, apparently, so every existing file was joined by its twin!

In a few moments, my file system had doubled in size, almost filled my disk, slowed down my computer, and I’d made myself very cross into the bargain!

OK, so that was just plain stupid. It was my fault entirely – should have read the instructions more carefully. Having written many pages of website, CMS and software help over the years,

  1. I know how difficult it is to be both terse and definitive, and
  2. I’m very familiar with the support desk acronym, RTFM: Read The … Manual!

Oh dear, now I’m now the on the receiving end, in a mess, what should I do about it?

example in windows explorer showing some files with the (2) suffixDeleting Many Files, Method 1

Now, luckily, the duplicate files are easy to spot. Each has the same filename as its twin, with “ (2)” appended before the period. Like this, right.

That’s easy enough to fix. Each time I open Windows Explorer I plan to delete the duplicate files manually, selecting them all with Ctrl-click and pressing the Del key.

More Reasons to Delete the Files

After a week or so using method 1, I’m not making much headway. Having deleted loads of files, the free disc space hasn’t increased very much. I can’t begin to guess how long it’s going ro take me to delete them all.

Then I open a picture using Picasa. Immediately, it starts indexing all the duplicate images – there must be 1,000’s of them! How on Earth am I going to get rid of all those?

This quickly became tedious, as you can imagine! So I need another method.

results searching for .txt in windows explorerDeleting Many Files, Method 2

If Windows is indexing your files, you can search for them using Explorer. Here we’re looking for files with a .txt extension in my Dropbox. Type a search term into the search box, top right in the Explorer window.  “*” means “anything”, so “*.txt” will list all files with a .txt extension. Not only that, but Explorer will list all the files matching the search term in this folder and all its sub-folders.

To delete them, use the mouse or press Ctrl-A to select them all, then press the Del key to remove them.

search results showing some files I do not want to deleteBut I only want to delete those with “ (2)” at the end of the filename, so, sadly, this won’t work for me. If I type “ (2)” into the search box, Explorer lists all the relevant files from all the sub-directories, but Explorer’s idea of what’s relevant is not the same as mine.

It lists every file with a 2 in the file name. I want to keep some of these. If I do it in My Documents, this method will delete files I may want to keep. It works the same with other search phrases, such as (2) or “(2)”.

This is because parentheses mean something to Windows Search: “Find everything inside the brackets.” Hence it lists all files whose file names contain 2.

How to Find File Names That Contain “(2)”

It suddenly occurs to me that (why didn’t I think of this earlier?), had I been using Microsoft’s original operating system, MS-DOS, I could have identified the duplicate files easily using a wildcard search. A search for *(2).* finds all files whose file name ends “(2)” with any file extension.

Now, Windows Search is very powerful. You can read all about it here. It even has a command that allows you to use these old search queries. To use the old syntax, begin your query with, tilde, “~”.

windows explorer identifies the correct files

So, all I need do is to press Ctrl-A, select all these files, and Del, delete them and move them to the Recycle bin. I test this in my Dropbox folder, which I can easily reinstate if doesn’t work.

Let’s try it in My Documents! It works.

More Files to Delete

Now the duplicates have gone from My Documents and from my Dropbox folder.

The Seagate system’s default setting seems only to backup and restore data files and images, not system files, .exe’s, .dll’s and other program files. There are many data files and images in the system directories, so I still have a lot of duplicates. Let’s run it on C:\ as well, to get rid of all the duplicates everywhere.

Conclusion, After Deleting Many Files and Saving 100’s of Man-hours

Even with all the testing, this process only took half an hour or so. I now have no files with (2) appended to the file name. It would have taken months to do it the manual way.

It also looks as though Picasa has lost the duplicates too. I checked several picture folders and they have all gone. In fact, Picasa tells me it’s “compacting its files to save space”, so it’s definitely noticed something going on!

I’m really pleased with the result!

Be Very Cautious When Deleting Files This Way!

caution! use with careDeleting one wrong file can be disastrous. Losing several, ten, one hundred, one thousand, when you don’t intend to, can be life-changing for your business, your marriage, your relationships…

  1. Always test your method on a directory (with sub-directories) that don’t matter: I tested this on a test folder, with test sub-folders, before doing it for real, then on my Dropbox folder, which can be recreated easily;
  2. Always back up your file system before you try anything like this, so you can recover your start position in case you make a mistake;
  3. IF IN DOUBT, LEAVE IT OUT!
    Get expert help from someone like Nortech Computers.

 

4 thoughts on “How to Delete Many Files Selectively

  1. jacob2017

    Hello Goodday, I use a software called Duplicate Files Deleter, it’s very easy to use and after it finds the duplicate files it lets you chose what you want to do with them (copy/delete/move). You can even check network files and you can check multiple paths in the same scan. This helps me alot. I hope you too.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *