[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rm difficult filename



Cameron Hutchison <camh+dl@xdna.net> said on Wed, 8 Sep 2004 15:24:56 +1000:
> Once upon a time Antonio Rodriguez said...
> > When capturing a file from an url with the command
> > mplayer -dumpstream -dumpfile archive.rm -playlist url
> > and other variants, by misplacing the option -rtsp-stream-over-tcp a
> > file was created with this name, i.e.,
> > -rtsp-stream-over-tcp is the filename.
> 
> Two common ways:
> 
> rm -- -rtsp-stream-over-tcp
> 
> or
> 
> rm ./-rtsp-stream-over-tcp
> 
> 
> In the first case, the -- tells rm to stop processing options, in the
> second case you're finding a way to refer to the same file in such a way
> that it does not start with -.

It should be noted this comes in useful for all gnu commands.

grep -i -- -CaSe-InSenSeTive-Regexp-With-A-Dash-At-Start -filename-with-a-dash-at-start

And if you get a filename with non-printable garbage in it, then you
can say

rm -i ?rtsp-str??m-over-t??

Use rm -i though, otherwise the first time you try this, you will make
a mistake :)

-- 
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
Disclaimer: Due to feline interference, this post may contain typographical
errors.



Reply to: