renombrar un archivo que inicia con guion

find . -name "-help" -exec mv {} help.txt \;
Sample Output
$ ls 
algo.txt -help
$ mv '-help' help.txt
mv: opci?n inv?lida -- h
Pruebe `mv --help' para m?s informaci?n.
$ find . -name "-help" -exec mv {} help.txt \;
$ ls
algo.txt help.txt

By: petrohs
2009-08-06 20:43:30

What Others Think

According to Google translate, it means something like "rename a file that starts with a hyphen". This is a complicated and unsafe way of doing it; if there's another file with the same name deeper down in the directory tree, it will overwrite the first one. Anyway, a better solution is mv ./-help help.txt
sunny256 · 632 weeks and 5 days ago
Or use "--" to signify the end of the flags: mv -- -help help.txt (Anything after -- is treated as an argument, not an option)
flatcap · 632 weeks and 5 days ago
zyxzak · 632 weeks and 4 days ago
?Escribamos ingl?s, por favor! Muchos usairos de este sitio web no comprenden el castellano. Let's please write English. Many users of this website do not comprend Spanish.
penpen · 632 weeks and 2 days ago
s/comprend/comprehend/ - such mistakes happen when you are in the wrong language mode ^^
penpen · 632 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: