tags:

views:

211

answers:

2
cp -v -ur path/to/jsps/ /dest/path/

The above command copies all of the files that have been updated from the source directory to the destination, preserving the directory structure.

What I can't figure out is how to copy only *.someExtention files. I know that you can use something like:

find -f -name *.jsp -exec some awesome commands {}

But I don't know how to do it (and I don't have time to read the info pages in detail).

All help is greatly appreciated.

Thanks, LES

+3  A: 

rsync might help - you can tell it to just copy certain files with a combination of include and exclude options, e.g.

rsync -a \
   --include='*.foo' \
   --include='*/' \
   --exclude='*' \
   path/to/jsps/ /dest/path/

See the manual and look at the section entitled FILTER RULES for more.

Paul Dixon
+1. You could make this work with find and cp, but rsync is really the better tool to use.
Eddie
+3  A: 

If you want to use find / cp then the following should do the trick:

find -f -name *.jsp -exec cp --parents {} /dest/path \;

but rsync is probably the better tool.

Eddie
I have not tested yet, but it looks like what I need. Thanks!I do some web dev and I often need to change a jsp and then copy the file over to the target directory (mvn directory structure). Rsync might be overkill.
LES2