Vista tip: Delete the Contents of a Folder Without Even Opening It

By Rick Broida, PC World |  Windows, Windows Vista Add a new comment

Monday you learned how to turn a folder into a "favorite" for quick and easy access. Okay, but what if you want a quick and easy way to clear out a folder while leaving the folder itself intact?

Sure, you can open the folder, tap Ctrl-A to "select all" files, and then hit the Delete key. But for fans of right-click context menus (you know who you are), there's another way. By making a simple change to the Windows Registry, you can add a function called Delete Folder Contents. It's great for those times when you want to empty a folder without trashing the folder itself--and without even opening it first.

One word of caution: Any time you monkey with the Registry, there's a risk of messing up Windows. It's a tiny risk, and I've performed this hack myself with no problems to report, but I just wanted you to be aware.

Here's the process:

1. Click Start, type regedit in the search box, and then hit Enter.

2. In Regedit, go to HKEY_CLASSES_ROOT\Directory\shell

3. Right-click on shell, choose New, Key, and name it Delete Folder Contents.

4. Right-click on the new Delete Folder Contents key, choose New, Key, and name it command.

5. In the right pane, double-click on the Default string value, and then copy/paste this text: cmd /c "cd /d %1 && del /s /q *.*

6. Click OK, exit the Registry, and you're good to go.

Now you can right-click on any folder (without actually opening it first) and you should see the new Delete Folder Contents option.

    Add a comment

    Post a comment using one of these accounts
    Or join now
    At least 6 characters

    Note: Comment will appear soon after you have activated your account.
    Obscene/spam comments will be removed and accounts suspended.
    The information you submit is subject to our Privacy Policy and Terms of Service.

    ITworld LIVE

    WindowsWhite Papers & Webcasts

    White Paper

    Microsoft Volume Licensing Reference Guide

    This guide provides an overview of the key features of Microsoft Volume Licensing programs. The information is presented by organizational type and size-two of the most important keys to determining your best Volume Licensing option.

    White Paper

    HP Software Licensing & Management Solutions for Microsoft

    See how HP Software Licensing & Management Solutions (SLMS) can help you identify the best Microsoft licensing program for your needs, get the most from your licensing agreement, and maximize your Microsoft software investment.

    White Paper

    Microsoft Open Value Program Guide

    In this overview, see how Microsoft Open Value provides a flexible, affordable way for small to midsize organizations (i.e. those with five or more desktop PCs) to use and manage all their Microsoft licensed products under a single agreement.

    White Paper

    Microsoft Volume Licensing Comparison - Enterprise

    With this quick-reference document, you can easily compare the available Microsoft Volume Licensing programs for enterprise organizations with 250+ devices, and tailor a program to help save costs, manage multiple licenses, and keep software up-to-date.

    White Paper

    Microsoft Enterprise Agreement Program Brief

    This white paper provides an in-depth look into how the Microsoft Enterprise Agreement Program provides with flexibility to choose among on-premises software and cloud services to best suit your user needs, and helps you optimize your technology spend as business priorities change.

    See more White Papers | Webcasts

    Ask a question

    Ask a Question