I discovered a neat trick to deleting folders/files based on a pattern. Let’s say you have a directory structure like this:
/test
/test/aaaa
/test/bbbb
/test/cccc
/test/ddd
/test/eee
/test/fff
You’ve decided that any folder with a’s, b’s, or c’s has to go. You definitely don’t want to delete them all by hand; especially if there are a couple thousand of them. The first thing you need to do is find the directories that you want to remove:
Which produces the following:
aaaa
bbbb
cccc
Great! Now what? All you need to do is pipe that to rm using xargs:
-
ls | grep "[a-c]" | xargs rm -rf
All files that match the given pattern will be deleted. But, be careful that the pattern only matches the files you would like to delete. Run ls | grep first before you pipe anything to rm, unless you like trying to restore deleted files.
Technorati : linux
February 28th, 2008 by Kevin Burke linux
It is unbelievably easy to integrate Ivy as a dependency manager for your grails application. Just a couple of steps really (Note: this is for grails >= 1.0 as < 1.0 had ivy integrated):
- Install the Ivy plugin:
-
grails install-plugin ivy
This will create an ivy.xml and an ivyconf.xml, and place them in the project root. I modified my ivy.xml thusly:
-
<ivy-module version="1.0">
-
<info organisation="codehaus" module="grails"/>
-
<dependencies>
-
<dependency org="mysql" name="mysql-connector-java" rev="5.0.5"/>
-
</dependencies>
-
</ivy-module>
- You can then run the following command and ivy will place your dependencies in the lib folder of your project root:
That’s it! Now I just need to figure out why they don’t really use this as a selling point for grails. The only thing I can figure is that there are so many great features it would get lost in the list anyway.
February 26th, 2008 by Kevin Burke grails