Ugly file name

Paul Neubauer neubauer at bsu-cs.bsu.edu
Fri May 12 02:05:51 AEST 1989


Sorry, all, I tried to reply to this by email, but it bounced.

In article <128 at tdl.UUCP> raulin at tdl.UUCP (Raulin Olivera) writes:
>	I posted this last week but didn't get any responses so

>	This is probably a real dumb question.  So my apologies
  Actually, the problem seems to arise all the time.
>	to the real hackers out there.  I wrote a "C" program
>	that writes to a text file.  I was supposed to put the
>	filename as an argument on the command line.  However,
>	I neglected to do so and I failed to include the 
>	proper diagnostics in the proper place in the program 
>	to exit the program when a filename was not provided.  So 
>	the program ran and created a real ugly filename.  In
>	ascii it looks like k~k^T^Nk^L and in hex it is
>	6B 7E 6B 14 6B OE 6B OC.  I can't figure out any way
>	to remove this file.  I would like to be a real man
>	and do it in "C" but I will accept any suggestions in
>	any manner of solution.

Well, it seems to me that writing a C program just to delete one file is a
bit of overkill.  The easiest way to get rid of it is probably just:

rm -i k*

where the '-i' prevents rm from rm'ing more files than you want to get rid
of and the 'k*' prevents it from asking for ALL of your files.  This kind of
problem seems to occur with greater than negligible frequency.  The other
variation of the problem is where you actually have USEFUL data in some file
that you can't get at because of bad file names.  I once left my brain at
home and named a file something like 'odds&ends' (on a BSD system).  I just
could not persuade csh to recognize that the '&' was to be considered part
of the filename -- it just kept putting all of my commands trying to refer
to the file into the background.  Then, just today I told the mailer that I
have been trying lately (elm) to save some mail into a file in a directory
other than my home directory.  The problem was, that instead of telling it 

	s dir/file

I told it:

	s dir file

and wound up with a file in my home directory with a space in its name! (the
actual names have been changed to protect the guilty :-) I finally resorted
to:

	cat dir* temp
	mv temp dir/file

As I see it (and this is NOT intended as a flame), this illustrates a
problem with the *nix filesystem:  filenames can be created that cannot then
be sensibly manipulated.  I LIKE the flexibility of *nix filenaming where
you are not required to have a '.' in all filenames (like some OS's which
shall remain nameless) and (at least with BSD) names can be reasonably long,
but it can be a hassle when you accidently create a file with a wierd or
ugly name and then cannot easily rename or delete it.  

-- 
Paul Neubauer         neubauer at bsu-cs.bsu.edu        neubauer at bsu-cs.UUCP
                      <backbones>!{iuvax,pur-ee}!bsu-cs!neubauer



More information about the Comp.unix.xenix mailing list