Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
Solved

# Problem with deleting folders

Posted on 2002-05-20
Medium Priority
5,618 Views
I run an ftp, and lately have run into a strange problem.  Someone has uploaded folders that I cannot delete.  These folders have a space at the end of the the name, so I cannot delete, rename, move, or do anything to them.

Anyone know any tricks to get rid of this problem? (without formatting)

Thanks!
-Luke
0
Question by:lwinkenb

LVL 18

Expert Comment

ID: 7023282
What OS?  are you trying to delete them from a GUI interface or a Dos interface?  or through the FTP?

What happens when you try and delete it?  get any error messages?
My suggestion is if you have a GUI interface, just drag it to the recycle bin....or highlight it and hit Delete.
Or, you can right mouse click on it and choose delete.
what happens when you try either of these routes?

Give us a little more info so we can help ya out.
0

LVL 10

Expert Comment

ID: 7023382
Try with quotes to delete these files.
Like "filename.ext " ?
0

LVL 4

Expert Comment

ID: 7023801
What OS? What error message do u get? What kind of file system do u have for the drive on which these folders are created? Check the security properties of these folders. If it is NT/2000 take the ownership of the folders and then try to delete them.
0

LVL 4

Expert Comment

ID: 7023804
If the drive is accessible from DOS (not command prompt, actual DOS) then you can delete them without a problem. Just a suggestion...kicking in the DARK!!!!!
0

LVL 7

Expert Comment

ID: 7023934
See if you can rename the directory. What is the directory name anyway's?

ren oldname newname

then del newname

let us know if any of these work will ya?
0

LVL 7

Expert Comment

ID: 7024220
Some more to try:

if you have fat file system try this:

say your directory name is this: directory (space)
then type in this in a command prompt:

rmdir directory?

this will remove ALL directories that are named directory(then something else).

I just created a test folder on my c:\ and used the rmdir command to delete it with no switches or parameters at all...worked for me...what exactly IS the file name?
0

LVL 7

Expert Comment

ID: 7024235
Crap, I just realized that we don't even know the OS involved here. If it's *nix then it should be quite easy, if it's winblows then it may take a few years, millions of dollars in research and lots, and lots, of chips and pepsi, but we'll eventually get it...
0

LVL 63

Expert Comment

ID: 7024417
For NT.2k/XP

JSI tip 2057 I went to the command line, switched to the directory and typed -- RD /S
"" This removed the offending directories and files (with names nt doesn't like) per and in similar
fashion to, what Tim Holman offered above which would probably have the same result.
http://www.jsiinc.com/tip2000/rh2057.htm

I hope this helps !
0

LVL 44

Expert Comment

ID: 7025760
Ok I think what has happened is that the hacker has added a character to the end of the folder that Explorer does not recognize.

Try this open a command window and do this

If NT Win2000 or XP Open a CMD.EXE window. If Win9x-ME open COMMAND.COM.
CD to the top of the mess.
Use: DIR /X /A   to see the SHORT FILE NAMES of the files and directories there.
Use a combination of CD, RD, and DEL and the SHORT FILES names reported with DIR /X to delete your
way to the bottom and then back up the tree removing the files on the way down and the directories on
the way up.
Most likely there is NOT a protection issue here so you shouldn't need worry about ownership or file
protections.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S      Removes all directories and files in the specified directory
in addition to the directory itself.  Used to remove a directory
tree.

/Q      Quiet mode, do not ask if ok to remove a directory tree with /S

This MS KB article may help

BEGIN ARTICLE

How to Remove Files with Reserved Names in Windows (Q120716)

--------------------------------------------------------------------------------

Microsoft Windows 2000 , Professional
Microsoft Windows 2000 , Server
Microsoft Windows 2000 , Advanced Server
Microsoft Windows 2000 , Datacenter Server
Microsoft Windows NT Server versions 3.1 , 3.5 , 3.51 , 4.0
Microsoft Windows NT Workstation versions 3.1 , 3.5 , 3.51 , 4.0
--------------------------------------------------------------------------------

SUMMARY
Because applications control the policy for creating files in Windows, files sometimes are created with illegal or reserved names, such as LPT1 or PRN. This article explains how to delete such files using the standard user interface.

NOTE : You must be logged on locally to the Windows computer to delete these files.

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 <path\command> [<args>] 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:
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

--------------------------------------------------------------------------------
Published Jun 3 1997 7:28AM  Issue Type
Last Modifed Dec 22 2001 12:57PM  Additional Query Words 3.10 prodnt CON PRN AUX CLOCK$NUL COM1 LPT1 LPT2 LPT3 COM2 COM3 COM4 winnt Keywords kbusage COPYRIGHT NOTICE. Copyright 2002 Microsoft Corporation, One Microsoft Way, Redmond, Washington 98052-6399 U.S.A. All rights reserved. END ARTICLE The Crazy One 0 LVL 7 Expert Comment ID: 7026970 I created special charactor folders using telnet on a win2k system yesterday and had no problems whatsoever deleting them from Win2k, no special switches or anything like that...also, created a folder named test(hit space bar at end of name-then enter to apply the named space(space bar))had no problems deleting that either using the cmd prompt....so it must be win98 0 LVL 5 Author Comment ID: 7027681 Sorry about the shortage of information: The OS is Microsoft Windows 2k Server Since the file system is ntfs, any DOS tricks are out of the question. I realize I can use a utility like system commander to convert the file system to fat32, but Im hoping there is an alternative solution. Unfortunatly I am late for work right now, so I can try any of the ideas given above yet. Will let you know if anything works later in the day. thanks, 0 LVL 7 Expert Comment ID: 7027805 So, this is really starting to bug me: do this: get yourself a linux boot floppy, you MUST know someone running linux... then, use it to boot your PC then mount the ntfs partition like this: mount -t ntfs /dev/hdaX /mnt (where X is the number of your drive, primary master in windows is hda0 and every drive is incremented by 1, so hda2,hda3,hda4 etc.etc,etc 0 LVL 44 Expert Comment ID: 7027858 As long as you are able to boot into the server you most certainly can use the methods I outlined. I know it works Just open cmd.exe and follow the intructions closely. 0 LVL 31 Expert Comment ID: 7027943 We had a machine getting hit approximately like this, and the buggers who did it also did some damage to the CMD.EXE file. The box is still sitting in a corner waiting for a reinstall.... I'll listen to this with interest... Regards /RID 0 LVL 7 Expert Comment ID: 7029494 OH YEAH, once you get onto the NTFS mount using the linux boot disk, cd to the directory where the file resides and type this at$ rmdir -rf <filename>

rm is remove -r = recursively(deletes all files and directories below specified dir to delete)

-f is to force the removal of the directory no matter what...

Cheers.

BTW---we still don't know the file name, take a screen shot and upload it to the web if you have to, we'd like to see it...
0

LVL 5

Author Comment

ID: 7030254
Well, unfortunatly the problem was worse than I thought.  Instead of it just being an undeletable folder, it turned into tens of thousands of undeletable folders.  There must have been a virus somewhere that kept creating new folders in the old ones.

I tried all of the ideas listed here (actually, I didn't get around to using a linux disk to mount the drive), and nothing worked.  Using short file names didnt even work.  At this point my server drive was out of free space, and I had to solve the problem fast.  I ended up having to use system commander to convert the file system to FAT32, and then delete the folders that way.

Sorry I didn't have the time to let you guys come up with some more ideas, but the server had already been down 2 days, and that is 2 days too many.
0

LVL 7

Expert Comment

ID: 7031653
Yes agreed, linux disk would worked if you did the following command:

rm -rf /path/to/directory
0

LVL 4

Expert Comment

ID: 7075229

It appears that this question has been abandoned.  Please take a moment to finalize the question & reward your points as appropriate.  If this question is not finalized within 7 days, Community Support will be requested to force close it.  Unless there is objection or further activity,  it will also be requested that points be awarded to the following expert(s) for their comments:

/EW

0

LVL 5

Accepted Solution

Netminder earned 0 total points
ID: 7135158
Per recommendation, points refunded and question closed.

Netminder
CS Moderator
0

Expert Comment

ID: 8607339
I ran into the same problem on my system.  Here is what solved it for me:
From a cmd prompt type the following command with this syntax: del "\\?\c:\dir_name_with_trailing_space "
0

Expert Comment

ID: 8951952
Hi,

i ran the rmdir /s command on a hackers directory on my computer through the command prompt.. It worked perfectly! Thanx guys!

/tevje
0

Expert Comment

ID: 9651285
just an fyi, i had a similar problem and CrazyOne's solution worked perfectly without much effort...i think he/she should be getting these points
i also posted crazyone's response to:

yeh it worked
0

LVL 5

Author Comment

ID: 9651784
None of his suggestions worked for me at the time, which is why I didnt award the points.  Plus you're about a year and a half too late on your suggestion.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
In this tutorial, we’re going to learn how to convert Youtube to mp3 for Free. We'll show you how easy it is to make an mp3 from your video clips so that you can enjoy them offline.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
###### Suggested Courses
Course of the Month13 days, 21 hours left to enroll