Loading
Home ›
Dealing with Odd Filenames on the Commandline
Trending Topics
| You Need A Budget | Feb 10, 2012 |
| The Linux powered LAN Gaming House | Feb 08, 2012 |
| Creating a vDSO: the Colonel's Other Chicken | Feb 06, 2012 |
| Your CMS Is Not Your Web Site | Feb 01, 2012 |
| Casper, the Friendly (and Persistent) Ghost | Jan 31, 2012 |
| Razor-qt 0.4 - Qt based Desktop Environment | Jan 30, 2012 |
- Fun with ethtool
- Parallel Programming with NVIDIA CUDA
- Readers' Choice Awards 2011
- 100% disappointed with the decision to go all digital.
- Linux-Based X Terminals with XDMCP
- Validate an E-Mail Address with PHP, the Right Way
- You Need A Budget
- The Linux powered LAN Gaming House
- Why Python?
- Python for Android
- Employment Posters
3 hours 12 min ago - Sure the best distro is
4 hours 32 min ago - BeOS was the best
7 hours 16 min ago - I use Wireshark on a daily
11 hours 46 min ago - buena información
16 hours 53 min ago - One important "bucket" that I didn't note (désolé si qqun deja d
17 hours 53 min ago - Gnome3 is such a POS. No one
1 day 3 hours ago - Gnome 3 is the biggest POS
1 day 3 hours ago - I didn't knew this thing by
1 day 9 hours ago - Author's reply
1 day 13 hours ago





Comments
Command lineish
Coud just use good old mc...
How to remove files that start with a dash
The simplest solution to removing a file beginning with a dash is to append ./ to the file name. So, to remove a file named "-" use: rm ./-
Removing filenames that start with a dash
This does work, but bash's wild-card expansion doesn't do this, so you can get caught by
rm *
where one of the filenames happens to be "-rf".
-gumnos
Bane of filenames -- beginning with a dash
The bane of my filename experiences are filenames that begin with a dash. They choke all sorts of command-line processing. Though many programs allow you to use a double-dash to separate command-line switches from filenames, not all programs support this convention. Little is as cruel as creating a file named "-rf /" and watching somebody try to remove that file...
Dashes suck...
Although I haven't dealt with it for a while, how does one deal with starting dashes? Would anyone be so kind as to post a script to find and change them to, say, an underscore?
In my previous experience I would have to change the name in gnome. But on servers with no X, this is a bit difficult.
- files
Dan I feel your pain. Does this provide relief: cd ..; rm subdir/-*; cd -