Brett Parker brettp@users.sourceforge.net wrote:
Right - using find and a small bash script I can do it ;) So, here goes, this has only been half tested, so I claim no responsibility if it manages to fry your cat, toast your grandmother, or, well, generally break things... Here's what I did...
(1) Create a shell script to copy a file with directory structure as follows: --- Begin ~/bin/copyfiles.sh Script Here --- #!/bin/bash
FILENAME=$1 DIRNAME=`dirname "$FILENAME"` DESTINATION="$2" mkdir -p $DESTINATION/$DIRNAME cp $FILENAME $DESTINATION/$FILENAME --- End Script ---
(2) change in to the structure I want to copy (in my case ~/public_html/test/)
(3) run the find command, somewhat as follows... find . -name *.html -exec ~/bin/copyfiles.sh {} /some/base/destination ;
And that should work...
And it does - thanks a lot Brett.
The only side effect was that it did fry my cat - his fur is still smouldering slightly as I write this so next time I shall wait until he's out of range :-)
Barry Samuels http://www.beenthere-donethat.org.uk The Unofficial Guide to Great Britain