Author Archives: brian

rsync vs. cp

rsync -a /path/to/bar/ /path/to/foo/ # => /path/to/foo/[contents of bar] rsync -a /path/to/bar /path/to/foo/ # => /path/to/foo/bar/[contents of bar]   cp -a /path/to/bar/ /path/to/foo/ # => /path/to/foo/bar cp -a /path/to/bar /path/to/foo/ # => /path/to/foo/bar why can’t cp have the same source behavior as rsync? btw, I found the solution on [...]
Posted in programming | Leave a comment

quick(er) way to symlink your `pwd`

I learned the other day about a neat shortcut for tilde expansion in bash. $ ls ~-/ The neat thing about this expansion is that it does tab completion. What this lead me to discover is that you can also do ~N, where n is a number refering to your directory stack. (the bash man page says [...]
Posted in programming | Leave a comment

renaming (lots of) files in bash

I found this method the other day. Unfortunately, I forget where. $ for f in `ls -1 | grep string`; do mv $f ${f/string/replace};done I’d like to find a method of using the bash command `find’, but this is pretty clean, and I don’t yet know how to manipulate the `{}’ in find -exec {} \; great site [...]
Posted in programming | Tagged | 2 Comments