Microsoft Windows – How to Delete or Rename a Stubborn File

There are several reasons why Windows might not allow you to delete a file:

  • The file might be in use in which case you can't delete the file until the program using it gives it up.
  • The file might be marked [gs read-only].
  • The file name might be so long that Windows can't handle it. File names with more than 260 characters in them are often difficult to delete.
  • There are also several reasons why Windows might not allow you to change the name of a [gs file]; particularly its extension. All above apply here; as well as...

  • Your system may not be showing file extensions by default.
  • We'll cover that one first and the others in turn.

    File Extensions Not Showing

    This is the most likely possibility for why you might not be able to change a file's type (i.e., rename the file extension). When Windows installs, one of the defaults is to turn off the showing of the full names for common file types. Basically, in Windows Explorer only the file's rootname shows; the extension is suppressed, yet is "shown" via the description in the File Type column of the Windows Explorer display.

    When Windows is set up this way, if you attempt to change a file's name you are only allowed to change the rootname of the file but not its [gs extension]. So, if you have a file that shows up as MYFILE as file type Text and you attempt to rename the file to MYFILE.DOC what you really have done is rename MYFILE.TXT to MYFILE.DOC.TXT and the file type in Explorer will remain Text instead of changing to a Word File.

    The File is in Use

    A file in use by the operating system generally can't be changed while the file is in use. A [gs file] in use by a program may or may not be able to be changed. These are not hard and fast rules and exceptions abound; particularly in a multi-user environment. But, if you try to rename or delete a file and Windows complains that the file is in use don't be surprised.

    To fix this you have to determine what is using the file. The error message that Windows pops up may or may not have that information in it.

    If you don't want to experiment a bit to figure out what might be using the file you can [gs restart] the [gs computer] with all startup options turned off. This will most likely not run whatever was using the file and the system will allow you to rename the file.

    Recognize that if you do this and then restart the computer with all startup options enabled some program will likely complain that it can no longer find the file you just renamed. This may or may not affect how your system performs (or even operates at all).

    To change the startup options, use the System Configuration Utility.

  • Click on the Start Menu.
  • Click on the Run item.
  • Type msconfig into the dialog box and click OK.
  • Use the various startup options settings to reconfigure your system [gs startup] as needed to find the subject program or process. Remember the caveat about how changing the name of a file a program or the system uses might affect system behavior. Keep good records so you can reverse what you did if necessary.

    If you want to experiment a bit, press the Control-Alt-Delete keychord (press all three keys at the same time) only once (if you press the keychord twice you will restart your [gs computer]). The Windows Task Manager will appear. Take the Applications tab and see if anything is running. If so, stop those programs (it's usually better to switch to the program and then close it from the program instead of picking Close from the Task Manager).

    Wait a bit as it sometimes takes Windows a bit of time to release all program assets. Then try to rename or delete the file. If you now can rename or delete the file you know one of the programs was using it (stop only one program at a time if you really, really want to know which one).

    If you still can't rename or the file you need to go to the Processes tab. There should be a number of running processes. Two of these are particularly important: Explorer and Systray.Do not end these. The other processes should be able to be stopped. Try stopping those processes you may recognize one at a time. Attempt to rename or delete the file after each has stopped. If you can, then you know what process was using the file.

    Keep going until only Explorer and Systray are running. If the file is still in use you've got your answer. The most basic processes in the computer are using the file. The same caveat as above applies: the file was in use for a reason and if you rename it or delete it the system may become unstable if you rename the [gs file].

    File is Marked Read-only

    This is the easy one. To find out if a file is marked [gs read-only] right click on the file in Windows Explorer. Select "Properties" from the menu that pops up. At the bottom of the dialog that appears are the attributes for that particular file. See if the Read-only box is checked. If so, you won't be allowed to modify the file.

    To take the [gs read-only] attribute off the file uncheck the box. Again, be aware that if some program requires that file to be read-only and you change that attribute or the file's name you may have system problems. Use caution.

    Note: If the file is in use (see above) or you don't have the necessary permissions (i.e., you're not logged in with administrator status) the [gs read-only] box may be greyed out and until you correct whichever condition is to blame you will not be able to change the attribute.

    How does a file get to be read-only? Most of the time it's by copying the file from a CD. Most CD media, by design, is read-only and often when you copy a file from a CD (or an install program copies the file) a read-only attribute will be given to the file because it was [gs read-only] on the CD.

    This doesn't happen often, but does happen often enough to cause some people problems.

    File Name is Too Long

    Windows has special problems dealing with extra long path/filenames. If the combination of the path and file names gets close to 255 characters (127 for Windows 95/98/ME) Windows will likely not handle it well if you try to delete or rename it (you can create it but not change it).

    While there are programs that can handle names that long or longer (e.g., FileBoss) the first thing to try would be to rename some of the folders that lead up to the file itself. Back the directory display up one level and then select and rename the folder the file is in. Try a single letter (obviously, keep a record of what folder you named to what so you can reverse the process!).

    Then, go back to the file and see if Windows then allows you to rename or delete it. If not, go back yet another folder and rename that one and so forth. At some point you should be able to find a series of reduced-length folder names that allow you to then rename the offending file to a short enough name to allow you to then recreate the original [gs directory] tree and still work with the file in question.

    SOURCE

    LINK (Filext.com)

    LANGUAGE
    ENGLISH