On Wed, 29 Dec 2004 15:26:17 +0100, Bob Alexander <[EMAIL PROTECTED]> wrote: > I keep a few different kernel source trees under /usr/src and each of > them has a different .config file. > > Part of my pre-backup script I would like to run a command such as > > find /usr/src -name .config > > for example: > > /usr/src/kernel-source-2.6.9-rja/.config > /usr/src/linux-2.6.10-rja/.config > > and for every match write a file to my /backup_data directory with a > filename that is made up like "kernel-source-2.6.9-rja.config" and > "linux-2.6.10-rja.config" or some similar unique filename which relates > the the kernel tree.
With 'find' you can -exec on each result. For example (note the trailing \; is required to end the exec string. find will execute all commands until that is found.): find /usr/src -name ".config" -exec cp {} /backup_data{} \; {} will be expanded to the entire path of the found file. The above line won't work because cp won't create the entire path "/backup_data/usr/src/kernel-source-2.6.9-rja/.config" :) You might want to process {} to create a proper destination. Hope that Helps! -- Darryl [EMAIL PROTECTED] http://smartssa.com / http://darrylclarke.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]