I am trying to write some automation into a tape based DR process for an elderly SCO unix Box
I have an archive of the live systems complete filesystem which I can recover using a carefully formatted cpio command. However I want to exclude a few of the top level directories from this recovery (mostly /stand).
I've worked out how to use the find command to extract only certain files, but how do I do the opposite ?
On 25-Jan-06 Wayne Stallwood wrote:
I am trying to write some automation into a tape based DR process for an elderly SCO unix Box
I have an archive of the live systems complete filesystem which I can recover using a carefully formatted cpio command. However I want to exclude a few of the top level directories from this recovery (mostly /stand).
I've worked out how to use the find command to extract only certain files, but how do I do the opposite ?
Hi Wayne,
If I've understood aright, you should be able to use the "-prune" optio to 'find'. See the explanation under the "-path" option in 'man find', as well as the "-prune" option near the end of the man page.
Alternatively, if you use 'find' to generate a list of files, these will be output with their parent paths, so you could pipe this output through 'grep -v' before using it as the list of files to be archived.
E.g.
find / -name '*.jpg' -print | grep -v '[/]stand'
or (if below the current directory "."):
find . -name '*.jpg' -print | grep -v '[.][/]stand'
Since you're apparently doing this on a SCO box, I don't know whether the 'find' on SCO has the same options as GNU 'find', but the 'grep -v' surely should work!
Hoping this helps, Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 25-Jan-06 Time: 23:58:15 ------------------------------ XFMail ------------------------------
Just realised I should have "tweaked" the 'find' suggestions below. See amendments below.
On 25-Jan-06 Ted Harding wrote:
On 25-Jan-06 Wayne Stallwood wrote:
I am trying to write some automation into a tape based DR process for an elderly SCO unix Box
I have an archive of the live systems complete filesystem which I can recover using a carefully formatted cpio command. However I want to exclude a few of the top level directories from this recovery (mostly /stand).
I've worked out how to use the find command to extract only certain files, but how do I do the opposite ?
Hi Wayne,
If I've understood aright, you should be able to use the "-prune" optio to 'find'. See the explanation under the "-path" option in 'man find', as well as the "-prune" option near the end of the man page.
Alternatively, if you use 'find' to generate a list of files, these will be output with their parent paths, so you could pipe this output through 'grep -v' before using it as the list of files to be archived.
E.g.
find / -name '*.jpg' -print | grep -v '[/]stand'
find / -name '*.jpg' -print | grep -v '^[/]stand'
or (if below the current directory "."):
find . -name '*.jpg' -print | grep -v '[.][/]stand'
find . -name '*.jpg' -print | grep -v '^[.][/]stand'
(the "^" ensures that the regexp matches at the beginning of the line only).
Since you're apparently doing this on a SCO box, I don't know whether the 'find' on SCO has the same options as GNU 'find', but the 'grep -v' surely should work!
Hoping this helps, Ted.
E-Mail: (Ted Harding) Ted.Harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 25-Jan-06 Time: 23:58:15 ------------------------------ XFMail ------------------------------
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 26-Jan-06 Time: 00:04:16 ------------------------------ XFMail ------------------------------