How to manipulate files with name like ‘-life.mp3′
March 21st, 2007 mysurface Posted in Common, mplayer, mv, rm | Hits: 21032 |
Sometimes, you may find some file you can’t delete because of the filename begins with minus(-). LBE have that example on the post “Remove file start with special character”, as simple as this
rm ./-life.mp3
The same way you can manipulate those files by mv, cp etc. The important highlights here is ./
dot(.) is actually means current directory and slash (/) is actually use to escape the minus(-). Without escaping the minus(-), linux commands will treat it as an option argument.
Therefore,
mplayer ./*.mp3
Is actually play all mp3 including those mp3 files with filename start with minus(-).
[tags]command, tips[/tags]
Live Chat!







March 22nd, 2007 at 10:26 am
?!
rm — -life.mp3
It’s a feature of gnu getopt, IIRC.
March 22nd, 2007 at 8:46 pm
Or you could try
rm — -life.mp3
March 28th, 2007 at 7:22 pm
[...] Por cierto este truco lo he leido en Linux by Examples y tiene algun que otro comando interesante. Consultad su web (en ingles). [...]