Hi Frank

There are two different approaches I can see to this.

1) Use this instead https://metacpan.org/pod/File::Find

2) Replace the `find ...` with this comma separated sequence of commands

          $cmd = "
            find $dir_to_search
            -name cache
            -prune -o
            -name tmp
            -prune -o
            -name session
            -prune -o -print",

          $cmd =~ s/\n/ /g,

          `$cmd`;


But I strongly recommend (1) for maintainability.

Andrew


On Thu, Jan 1, 2015 at 9:19 PM, SSC_perl <p...@surfshopcart.com> wrote:
>         Is it possible to wrap a `find` command on multiple lines in a 
> script?  This is what I'm using now:
>
> foreach $dir_to_search (@dirs_to_search) {
>         $dir_count--;
>         @files = map {
>                 s|/home/user/public_html ||;
>                 $_;
>         } `find $dir_to_search -name cache -prune -o -name tmp -prune -o 
> -name session -prune -o -print`;
>
>         I'd like to be able to do something like this to make it more 
> readable:
>
> foreach $dir_to_search (@dirs_to_search) {
>         $dir_count--;
>         @files = map {
>                 s|/home/user/public_html||;
>                 $_;
>         } `find $dir_to_search
>                 -name cache -prune
>                 -o -name tmp -prune
>                 -o -name session -prune
>                 -o -print`;
>
> however my searches have turned up nothing.  Using returns, commas, 
> backslashes, or concatenation breaks the find.  Does anyone know if this is 
> doable?
>
> Thanks,
> Frank
> SurfShopCART
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>



-- 
Andrew Solomon

Mentor@Geekuni http://geekuni.com/
http://www.linkedin.com/in/asolomon

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to