Solved

Problem with deleting folders

Posted on 2002-05-20
23
5,467 Views
Last Modified: 2007-11-27
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
Comment
Question by:lwinkenb
23 Comments
 
LVL 17

Expert Comment

by:Wakeup
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

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

Expert Comment

by:MFK
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

by:MFK
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

by:jatcan
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

by:jatcan
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

by:jatcan
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

by:SysExpert
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

by:CrazyOne
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)

--------------------------------------------------------------------------------
The information in this article applies to:


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
Microsoft Windows NT Advanced Server
--------------------------------------------------------------------------------

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.

MORE INFORMATION
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:
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

--------------------------------------------------------------------------------
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

by:jatcan
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

by:lwinkenb
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Expert Comment

by:jatcan
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

by:CrazyOne
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

by:rid
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

by:jatcan
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

by:lwinkenb
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

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

rm -rf /path/to/directory
0
 
LVL 4

Expert Comment

by:EricWestbo
ID: 7075229
** PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER **

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:

N/A; situation resolved by asker

If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post a request in Community support (with a link to this page) to refund your points.  The link to the Community Support area is: http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt


/EW

** PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER **
0
 
LVL 5

Accepted Solution

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

Netminder
CS Moderator
0
 

Expert Comment

by:LiveDrive
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

by:tevje
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

by:bheavey11
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:
http://www.tek-tips.com/viewthread.cfm?SQID=679065&SPID=779&page=1

yeh it worked
0
 
LVL 5

Author Comment

by:lwinkenb
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Occasionally Windows/Microsoft Updates will fail to update. We have found a code that will delete all temporary files and re-register all dll's related to Windows/Microsoft Updates! This works 99% of the time to get the updates working again! The…
Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now