On Thu, 11 Jun 1998, Pete Turnbull wrote:
On Jun 11, 3:36, Doug Yowza wrote:
That used to be one of my interview questions for
Unix programmers: your
buggy program just created a filename with {control characters, leading
dash (-), leading slash (/), '*', etc} in it. How do you delete it?
Quickest general method is "rm -i *", though you may sometimes need
"rm -i .*" instead/as well.
If you had a file named "-f" in your directory, then "rm -i *" would
happily delete all of the files in the directory without prompting you.
"rm -i ./*" would be better, but would not work for files with control
characters or spaces.
If you wanted to stick with the "-i" approach, then "cd .. ; rm -r -i
dir"
would be the best bet (assuming your rm had a -r option to recurse).
-- Doug