Joe Acquisto | 16 Nov 2011 19:47
Picon

delete linux file that begins with special character

I have a directory that contains a zero length file with this name "<table
border=5>" (no quotes).  Cannot delete it.  Know how to delete files
starting with - but those techniques to not seem to work on this one. So
far, Google is not my friend.

joe a.
Joe Doupnik | 16 Nov 2011 19:49
Picon
Picon
Favicon

Re: delete linux file that begins with special character

On 16/11/2011 18:47, Joe Acquisto wrote:
> I have a directory that contains a zero length file with this name "<table
> border=5>" (no quotes).  Cannot delete it.  Know how to delete files
> starting with - but those techniques to not seem to work on this one. So
> far, Google is not my friend.
>
> joe a.
>
----------
     Man rm. See the -i option to invoke interactive mode. rm -i *table* 
would be useful.
Similarly, escape the special characters, using a backslash prefix.
     Joe D.
James Taylor | 16 Nov 2011 21:35

Re: delete linux file that begins with special character

I assume you have tried deleting with quotes and/or escaping the special characters?

I have seen file names that had hidden characters that were extremely difficult to remove.
One thing that has worked for me is to list the file in a gui file manager and rename it.
It will often allow you to rename that way because you are not having to type in the exact name or matching
wildcard string to replace it.
-jt

James Taylor
678-697-9420
james.taylor <at> eastcobbgroup.com

>>> Joe Acquisto <joe.acquisto <at> gmail.com> 11/16/2011   12:47 PM >>> 
I have a directory that contains a zero length file with this name "<table
border=5>" (no quotes).  Cannot delete it.  Know how to delete files
starting with - but those techniques to not seem to work on this one. So
far, Google is not my friend.

joe a.
_______________________________________________
Novell mailing list
Novell <at> netlab1.oucs.ox.ac.uk
http://netlab1.usu.edu/mailman/listinfo/novell
Joe Acquisto | 16 Nov 2011 22:03
Picon

Re: delete linux file that begins with special character

Yes, I had tried escaping, etc.  no joy.

If the suggestion Joe D made had not worked, I would have tried to fire up
a gui file manager and a work some visual voodoo.

But, as stated earlier, without his suggestion, it might have been some
time before it dawned on me that it would offer the file, using the wild
cards.  That's one for near term storage.

joe a.

On Wed, Nov 16, 2011 at 3:35 PM, James Taylor <
James.Taylor <at> eastcobbgroup.com> wrote:

> I assume you have tried deleting with quotes and/or escaping the special
> characters?
>
> I have seen file names that had hidden characters that were extremely
> difficult to remove.
> One thing that has worked for me is to list the file in a gui file manager
> and rename it.
> It will often allow you to rename that way because you are not having to
> type in the exact name or matching wildcard string to replace it.
> -jt
>
>
>
> James Taylor
> 678-697-9420
> james.taylor <at> eastcobbgroup.com
(Continue reading)

Paul Gear | 16 Nov 2011 22:50
Picon
Favicon

Re: delete linux file that begins with special character

On 17/11/11 07:03, Joe Acquisto wrote:
> Yes, I had tried escaping, etc.  no joy.
>
> If the suggestion Joe D made had not worked, I would have tried to fire up
> a gui file manager and a work some visual voodoo.
>
> But, as stated earlier, without his suggestion, it might have been some
> time before it dawned on me that it would offer the file, using the wild
> cards.  That's one for near term storage.

Another technique that will nearly always work is using single quotes
(unless the file name itself contains single quotes), because that
prevents all shell variable substitutions, special characters, and
wildcard expansions.

If you ever accidentally create a file beginning with a hyphen, you'll
find that hard to delete as well.  The trick in that case is to indicate
the end of the rm options list by using a double hyphen:
    rm -- -my-file-name-beginning-with-hyphen-

Paul

Gmane