Discussion Locked

How to delete a reserved filename dir?

0 helpful
33 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Do you have any idea how to remove a dir called com1. I have tried all the standard tools, because the file is named a windows reserved name "com1" that normal tools do not work.

del \\.\e:\ftp\com1 does not work. ::: bypass checking for reserved filenames

rm com1 does not work. ::: rm.exe is a posix utility.

Any ideas?

1000 points for the right answer!!

Thanks

33 replies

by stillatit

Here is a list of things to try:

If you are working from windows, highlight the directory in explorer, right-click, select rename, and change the name of the directory. Then delete it.

From DOS, move into the directory directly above it, then type
rd "com1"
including the quotes. Note that you want rd rather than del. (If you are using a unix varient, use rmdir to remove a directory.)

If that does not work, try the rd command with the full path in quotes.

You could also try the rencommand, with the name in quotes, to try to rename the directory to something else, so you can kill it normally with the rd command.

Good luck.

by sabatogz

If you are working from windows, highlight the directory in explorer, right-click, select rename, and change the name of the directory. Then delete it.

Result: Cannot rename com1. Access is denied

From DOS, move into the directory directly above it, then type
rd "com1"
including the quotes. Note that you want rd rather than del. (If you are using a unix varient, use rmdir to remove a directory.)

Result: Access is denied

If that does not work, try the rd command with the full path in quotes.

Result: Access is denied

You could also try the ren command, with the name in quotes, to try to rename the directory to something else, so you can kill it normally with the rd command.

Result: Access is denied

Thanks: Stillatit

by spydergst1

If you can reboot the machine that may help. If rebooting does not work boot with a 98 diskette and delete it then reboot into nt. Be sure to get a full backup first and create an emergancy repair disk also, print out a copy of the NT diagnostics report just to play it safe.

by spydergst1

If you can reboot the machine that may help. If rebooting does not work boot with a 98 diskette and delete it then reboot into nt. Be sure to get a full backup first and create an emergancy repair disk also, print out a copy of the NT diagnostics report just to play it safe.

by shmaltz

If access is denied then its a security issue. Set the permissions so that you have permission to delete it.
What if you try deleting it from widnows explorer?

by sabatogz

I have logged in locally and have tried to take ownership of the dir. and have also tried to change permissions. Both result in No Access.

Thanks: Newyorker211 !

by mm212

Try disabling COM1 in the system setup. Once you do that and reboot, try rd again.

by gmscne

The "access denied" error generally means that some program or process is holding control of the item. It may be that some communications program is running in the background. Try stopping all the processes that you can and then try deleting the directory. Something may be using a hidden file in there also.

by shanghai sam

The folder is empty and I have stopped critical service while attempting to remove the folder. Good Idea though!!

by mackem

You could try deleting through the regedit facility. I think you will find the key at HKEY_LOCAL_MACHINE/Device Maps/Serialcomm.
I'm not sure it will allow you to delete from here, right clicking on "Com1" Delete is one of the options. You may have to do a search within the registry for any other references to "Com1" and delete them also.
I know I don't have to tell you, but please remember to make a backup of your registry before you make any changes to it.
Hope this helps.

by shmaltz

Do you have administrative rights?
If you do you have to be logged on the remote computer with administartive rights.

by dao251

Wonderful discussion :-)
The correct answer is: RTFM

I mean MS KB atricle Q120716:
http:
//support.microsoft.com/support/kb/articles/Q120/7/16.asp

(remove blanks from the reference probably added by this web interface)

Dima

by dao251

You probably missed an RM commandline switch.
Also, take into account that filepath/filename is case-sensitive for RM utility.

by sabatogz

Thanks for the reference. Unfortunately that was the first thing I did when I ran into this problem is check Microsoft's Technet.

Thanks: DAO251

by james a bailey

An answer above advised you to reboot, then reboot with a 98 boot disk, then delete it. You commented that rebooting does nothing,
I am wondering what happened when or if you tried to boot from the 98 boot disk. Usually you can delete anything from a boot disk.

by shanghai sam

I may have left out some critical info. The system is an NT server with SP6 on the NTFS file system.

by dao251

Well, if that KB article does not work you have to be more specific. What kind of error message you receive using RM -d or RM -r ?

BTW, the first thing I did when read this, I created a folder C:\Temp\Com1 and then deleted it using RM exactly as described in that Q-article. I guess your problem is more sophisticated than simply naming problem.
Is your E: drive local? Are you sure you use proper case in path/names? etc.

Cheers,
Dima

by dao251

Just another idea. Was it created by using FTP? Try to delete it same way! And make sure FTP service is not running when using RM....

by shanghai sam

Maybe I'm using the wrong rm.exe file. I was unable to find the file on Microsoft's web site, so I did a search and downloaded the file from the net. If someone has the posix rm.exe could they email me the file at it@hcbridges.com.

The com1 folder was created on an anonymous ftp site. I'm unable to remove the folder with IIS turned off. I have also tried to create the same dir on another computer and windows will not allow that, I have also tried with DOS also and thru our FTP program.I'm logged in local and the E drive is a local drive

I think if I get the right RM.exe file I may have some success.

Thank you DAO251 !!!!

by estebandelatorre

Use the dot as it's end. eg:
rd com1.
Using the "com1." will also be usefull
Sometimes the extension may have unprintable characteres and you were unable to delete the file or subdir.

Have you ever try MD MYShare
So check for the extension too

by maxwell edison

If the file was created on a file allocation table (FAT) partition, you may be able to delete it under MS-DOS using standard command line utilities (such as DEL) with wildcards. For example:

DEL PR?.* -or- DEL LPT?.*

These commands do not work on an NTFS partition as NTFS supports the POSIX subsystem and filenames such as PRN are legal under this subsystem. However, the operating system assumes the application that created them can also delete them; therefore, you can use commands native to the POSIX subsystem.

You can delete (unlink) these files using a simple, native POSIX application. For example, the Windows Resource Kit includes such a tool, Rm.exe.

NOTE : POSIX commands are case sensitive. Drives and folders are referenced differently than in MS-DOS. Windows 2000 and later POSIX commands must use the following usage syntax:
posix /c [] IE: posix /c c:\rm.exe -d AUX.

Usage assumes Rm.exe is either in the path, or the current folder:

rm -d // driveletter / path using forward slashes / filename

For example, to remove a file or folder named COM1 (located at C:\Program Files\Subdir in this example), type the following command:

rm -d "//C/Program Files/Subdir/COM1"

To remove a folder and its entire contents (C:\Program Files\BadFolder in this example), type the following command:

rm -r "//C/Program Files/BadFolder"

Another option is to use a syntax that bypasses the normal reserve-word checks altogether. For example, you can possibly delete any file with a command such as:

DEL \\.\ driveletter :\ path \ filename
For example:

DEL \\.\c:\somedir\aux

Good luck,

Maxwell

by matthew guy

you obviously don't care about these people trying to help yith your stupid, most likely self inflicted, problem. why not just make a career jump, and wash dishes for a living?

This discussion is closed to new replies.