Ugly file name

Juergen Wagner gandalf at csli.Stanford.EDU
Wed May 17 06:57:09 AEST 1989


Sigh! There we go again...

You can delete files with the `rm' command, or with the following C program:

	# define FILE "..."	/* name of file to remove */
	main()
	{
	  if (unlink(FILE) < 0)
	    perror("unlink");
	  exit(0);
	}

Let's call this program "do-rm".

Ok, now here are the cases:

[1]	Files with ASCII characters (20h..7eh) in their names:

	Cd to the directory containing the file to be removed. Execute
		/bin/rm './FILE'
	where FILE is the name of your file. If your file name contains
	single quotes, you have to use a more tricky quoting scheme, e.g.
		/bin/rm './-foo'"'"' bar'"'"
	will remove the file named
		-foo' bar'
	from your currect directory. Don't forget to put backslashes in
	front of '!'s (if you're in csh).

[2]	Files with characters in the range 01h..1fh, 7fh in their names:

	The same method as under [1] is applicable, but now the non-printing
	characters have to be included in the file name. Non-printing
	characters can be typed by using ^V to prevent interpretation.
	(^V is the lnext character, it can be set with stty). Note that
	newline characters (0ah) have to be preceded with a '\'.

[3]	Files with characters in the range 80h..ffh in their names:

	Most shells don't like the idea of having 8-bit characters, i.e.
	shell commands won't work, even if you manage to get the correct
	characters into the argument. In such cases, the above C program
	can be used (short of clri and fsck).

I hope that helps to clarify the situation. If you [the reader] have any
comments on this posting, please reply to me. DON'T POST YOUR REPLIES.

-- 
Juergen Wagner		   			gandalf at csli.stanford.edu
						 wagner at arisia.xerox.com



More information about the Comp.unix.wizards mailing list