the basic plot is, i need to find certain files within a directory tree, and when found, append the contents of all the found files into one giant file... with a couple of exceptions:
root dir: /home/tdawg/workspace/zoo
file(s) to find: list.dat
so i started with find2perl
use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; sub wanted; # Traverse desired filesystems File::Find::find({wanted => \&wanted}, '/home/tdawg/workspace/zoo'); exit; sub wanted {" /^list\.dat\z/s && print("$name\n"); }
now before trying to copy the contents to some giant file (>> giant.file) there are 2 exceptions
1)within the root directory, there is only a subset of those directories i want to traverse. I actually only want to search through /home/tdawg/workspace/zoo/abc1* directories. Of course putting a wildcard in there like that doesn't work. So if zoo contains the dirs:
abc1_dos
beta_dos
prod_tres
abc1
we will only traverse through the abc1_dos and abc1 subtrees.The next exception is that we don't care about list.dat if its in certain sub-directories. we want to ignore list.dat if its under a dead or baby sub-directory.
/home/tdawg/workspace/zoo/abc1/adult/main/list.dat #yes!
/home/tdawg/workspace/zoo/abc1/dead/list.dat #ignore
/home/tdawg/workspace/zoo/abc1/biped/baby/list.dat #ignore
if someone can help me get to the point where I am working only with the list.dats that i want, it would be much appreciated. Various ways of trying to exclude things like /^baby/s within the wanted sub are not working for me.
In reply to getting picky with File::Find by klink'on
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |