Results 1 to 4 of 4
  1. #1
    Joined
    Nov 2001
    Location
    I've moved.....I'm over here now.
    Age
    60
    Posts
    7,290

    HOWTO: File Deletion in Windows

    The question of how to delete stubborn files in Windows is one that comes up often. This short howto has been developed in the hope that a simple, coherent procedure will make the process as painless as possible as well a provide a consistent plan of attack. That said, it would be wise to make sure that the object file is truly one you wish to remove since the removal of a critical system file can/will produce undesirable results as well as additional work for the remover.*

    Start with the simplest, although if you're reading this for more than the exercise of casual reading, you've likely already tried and the simplest didn't work. Still, the beginning is a good place to start. Pick the file in Explorer and delete it.

    If that doesn't work, go to command line and try to delete it. If you get an "access denied" error, attrib the file using the command
    Code:
    attrib -r -s -h <filename>
    This command removes the readonly, system and hidden attributes from the file and, hopefully, should make the file easier to remove. Attempt to delete the file again.

    Sometimes Explorer decides to protect a file, even when deleting from the command line. If this happens, bring up the Task Manager, move to the Processes tab, find the Explorer process and terminate it. If you don't already have a command window open, click on File, pick New Task, type cmd and hit enter. You should be able to delete the file without any further issue.

    If you are using Windows XP Pro or Windows 2000, you have another option to try - taking ownership of the file.

    1. If using Windows XP Pro, open an folder view windows, click on Tools->Folder Options->View, scroll to the last item and make sure "Use Simple File Sharing" is unchecked. Apply changes if necessary.
    1a. If you're using Windows XP Home Edition, you have two choices: you can either boot to Safe Mode so that the file Security Tab will be available to you, or you can download and install scesp4i.exe - which is the NT 4.0 Security Configuration Editor - and have the capability even in Normal Mode. I had to Google this file since it appears to be a dead link (at least for me, today) on MS' site. Download this file, unpack to a temporary directory, right-click the setup.inf file and pick install. After rebooting, the file Security Tab will be available to you in Normal Mode. Disclaimer: You do this at your own risk. I tried it on an installation of XP Home and it worked without issue. Make a System Restore point for insurance.
    2. Navigate to the file or folder you wish to take ownership.
    3. Right click the file/folder->Properties->Security and click the Advanced button.
    4. Click the Owner Tab, highlight Administrators (this is my personal recommendation for owner), check the box that says "Replace owner on subcontainers and objects" (if present). Apply your changes.
    5. Answer the subsequent prompt by clicking Yes. The files now belong to you.


    If you still can't delete it, odds are very good that the file is in use. If this is the situation, you might first try removing the file in Safe Mode. In the event that the file is still in use, which is the case with some malware/virus type files, you can try using the application at http://www.snapfiles.com/get/moveonboot.html (originally brought to my attention by Will889). And, for information on what has your file locked (link provided by Mjölnir), you might try http://www.dr-hoiby.com/WhoLockMe/index.php.

    Personally, if I get to the point that none of the above steps work, before I even get to the Safe Mode step, I remove the drive and connect it as a data drive on another machine and delete whatever files I want. It's possible that you will still have to take ownership during this step, but it's guaranteed to work.

    On a related note, Windows 2000 and XP do not have a deltree command, per se, but the following command serves the same purpose and works quite well:
    Code:
     rd <directoryname> /s /q
    As a bonus, this command works much faster than attempting the same thing using Explorer. One should take care when mass deleting files in this manner, since the /q switch bypasses the confirmation dialogue Windows would ordinarily present.

    Further, it should be noted that files deleted from a command prompt are much more difficult to recover than files deleted in Windows Explorer (assuming that you don't use shift+delete). To me, this is a bonus.

    *If in doubt as to the wisdom of removing a file, you might Google the filename first to make sure it's not a sytem file (with Windows 2000 or XP, hopefully Windows File Protection will come to the rescue) or is not an integral part of some memory resident software like a software firewall or antivirus program. Additional resources (courtesy of Mjölnir) include, but are not limited to:

    www.liutilities.com/products/wintaskspro/processlibrary
    www.fileresearchcenter.com
    www.processlibrary.com
    www.sysinfo.org/startuplist.php
    www.windowsstartup.com
    Last edited by Sick Willie; 12-14-2005 at 02:42 PM. Reason: Elaborated on the Taking Ownership Section

  2. #2
    Joined
    May 2002
    Location
    connecticut
    Age
    55
    Posts
    210

    Re: HOWTO: File Deletion in Windows

    another good program is Copylock. have used it many times to delete stubborn files. just google it.
    Ubuntu User #15003
    Linux User #448521

    AMD Phenom II X4 @ 3.4ghz/8GB DDR3/NvidiaGT430/Ubuntu 11.10

  3. #3
    Joined
    Jul 2008
    Posts
    1

    Resolved Re: HOWTO: File Deletion in Windows

    i Have Lost Password In my Windows ! But i cannot log If I Format Drive Is Only c:, No Partition So What To Do ?

  4. #4
    Joined
    Mar 2002
    Posts
    4,169

    Re: HOWTO: File Deletion in Windows

    Quote Originally Posted by wolfen69 View Post
    another good program is Copylock. have used it many times to delete stubborn files. just google it.
    I use Unlocker 1.8.7 to accomplish the same.

    A true patriot is a lover of his country who rebukes and does not excuse its sins.
    - Frederick Douglas

    May we never confuse honest dissent with disloyal subversion. - President Dwight D. Eisenhower

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •