by PascalW · 15y ago · 0 comments
mv /path/to/some/file.{jpg,png}
Has been a huge timesaver. It's the same as mv /path/to/some/file.jpg /path/to/some/file.png
But saves you the typing/copy pasting the path for the second argument. Can also be used with cp etc. rename jpg png /path/to/some/file.jpg rename 's/jpg/png/g' /path/to/some/file.jpgI prefer the regex one, of course, especially since it takes proper Perl regexes :)
You have to be careful of this though and probably avoid using this command in shell scripts.
edit: You can just stick Debian's rename at $HOME/bin/rename.pl and call it a day; this command is useful in the terminal since it's less typing than a for loop.
> ls *.{png,jpg,bmp,gif}
But this gives error if there is no jpg files. In bash, you can activate the extglob mode with "shopt -s extglob" and do this : > ls *.@(png|jpg|bmp|gif)
http://www.faqs.org/docs/bashman/bashref_35.htmlhttp://www.gnu.org/software/bash/manual/bashref.html#Brace-E...
And it's even better in zsh.
http://zsh.sourceforge.net/Doc/Release/Expansion.html#Brace-...