Welcome, Guest. [ Log In ]
Question   Deleting files/directories with special meta-characters.
Search KBase


Top 5 in this Area:
1. How do I upload files (publish) to my site?
2. Can I upload files without an FTP client?
3. Commonly used FTP clients
4. I don't know what the FTP address is!
5. How do I upload to a sub-domain?

 
Deleting files/directories with special meta-characters.
I have created a directory with a weird character in it (in this case, a tilde '~' character), and my FTP client won't let me delete it. I'd really like to get rid of it.

Many operating systems have special characters, called 'meta-characters', which carry special meanings. For instance, a period in a DOS/Windows style file name usually comes before the file's extension (which identifies the file type). Due to its DOS underpinnings, Windows also recognizes a whole host of other characters, such as asterisks and spaces as have special meanings.

The Macintosh only has one such character, the colon. All other characters are legal and perfectly usable in file and folder names.

Our servers run on Linux, which is a very close cousin to Unix. Just as with most forms of Unix, Linux has its own share of special characters. For example, take the following path name:

     /home/fred/mydomain.com/index.html

The forward-slash character (aka. '/') is a special character that designates the seperation between different directories and files. Here is another example:

     ~/mydomain.com/index.html

In this case, the tilde character (aka. '~') is being used at the beginning of a path. Why? Well, the tilde is a special meta-character that denotes the start of a user's home directory. This is basically used as a shortcut for the standard '/home/username/' path. There are many characters such as these that carry special meanings.

Deleting Files/Directories With Odd Names

The tricky part about this is that you can actually use these characters in file and directory names (and occasionally, we find someone that does). Usually this doesn't cause too many problems until the point that an individual wishes to perform a function on the file or directory, and receives an error message. In particular, graphical FTP clients such as NetFinder or WS_FTP have trouble handling such filenames. If you attempt to delete such an item from your shell using the following command (as usual):

     rm -r ~dirname

...you will usually end up gaining nothing but an error message. The way to delete such an item from a shell is to surround the file or directory name in quotes, ie.

     rm -r "~dirname"

...this way, the name is interpreted exactly as it is typed, instead of applying special meaning to any particular meta-characters found (in this case, a tilde).

If you do not have a plan which provides shell access via telnet, just send us a message via the tech support form and we can delete the file or directory for you. Of course, the best technique to avoid such problems is generally to avoid creating items with such names to begin with.

Last updated: Jul 11, 2001.