none
How do I delete a locked file?

    问题

  • I'm getting "file is in use" errors when trying to delete some files from Server 2008.

    I know the file is definitely not is use, so how do I delete it?  Ideally I would like to use Powershell if anyone can show me a way please, but really any method is fine.

    Thanks

    2012年10月2日 21:58

答案

全部回复

  • Have you seen this ?

    http://www.leeholmes.com/blog/2009/02/17/moving-and-deleting-really-locked-files-in-powershell/



    Don't forget to mark your posts as answered so they drop off the unanswered post filter. If I've helped you and you want to show your gratitude, just click that green thingy.

    2012年10月3日 6:04
  • Thanks, but that method deletes the file on the next reboot.  I cannot schedule any downtime at the moment so this isn't viable.
    2012年10月3日 6:24
  • Hi,

    I would like to suggest you delete them with a third party tool, “Unlocker”. You may search it by Bing.

     

    Note: The third-party product discussed here is manufactured by a company that is independent of Microsoft. We make no warranty, implied or otherwise, regarding this product's performance or reliability.

    For more information, please also read the following article:

     

    Solved: “Cannot read from the source file or disk”

    http://blog.dotsmart.net/2008/06/12/solved-cannot-read-from-the-source-file-or-disk/

    Regards,

    Arthur Li

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Arthur Li

    TechNet Community Support

    2012年10月4日 9:13
    版主
  • Hi,

     

    I would like to confirm what is the current situation? If there is anything that I can do for you, please do not hesitate to let me know, and I will be happy to help.

    Regards,

    Arthur Li

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Arthur Li

    TechNet Community Support

    2012年10月8日 7:01
    版主
  • Can’t delete/ copy file? Please look that, LONG PATH Error Fixer helped me in this situation. Actually “Long Path Tool” is so usefully for this problem. So try it today.

    2012年10月20日 16:32
  • I still suspect an open handle was preventing closure.  Future readers with similar problem could try Handle to view file locks in process.

    usage: handle [[-a] [-u] | [-c <handle> [-l] [-y]] | [-s]] [-p <processname>|<pid>> [name]
    -a	Dump information about all types of handles, not just those that refer to files. Other types include ports, Registry keys, synchronization primitives, threads, and processes.
    -c	Closes the specified handle (interpreted as a hexadecimal number). You must specify the process by its PID.
    WARNING: Closing handles can cause application or system instability.
    -l	Dump the sizes of pagefile-backed sections.
    -y	Don't prompt for close handle confirmation.
    -s	Print count of each type of handle open.
    -u	Show the owning user name when searching for handles.
    -p	Instead of examining all the handles in the system, this parameter narrows Handle's scan to those processes that begin with the name process. Thus:
    
    handle -p exp
    
    would dump the open files for all processes that start with "exp", which would include Explorer.
    name	
    
    This parameter is present so that you can direct Handle to search for references to an object with a particular name.
    For example, if you wanted to know which process (if any) has "c:\windows\system32" open you could type:
    
    handle windows\system
    
    The name match is case-insensitive and the fragment specified can be anywhere in the paths you are interested in.


    Don't forget to mark your posts as answered so they drop off the unanswered post filter. If I've helped you and you want to show your gratitude, just click that green thingy.

    2012年10月23日 8:15