3 # Find files under some directory
5 require './file-lib.pl';
6 $disallowed_buttons{'search'} && &error($text{'ebutton'});
9 print "Content-type: text/plain\n\n";
10 if (!&can_access($in{'dir'})) {
11 print $text{'search_eaccess'},"\n";
14 $in{'dir'} =~ s/^\/+/\//g;
15 if ($in{'dir'} ne '/') {
16 $in{'dir'} =~ s/\/$//;
18 $cmd = "find ".quotemeta(&unmake_chroot($in{'dir'}))." -name ".quotemeta($in{'match'});
20 $cmd .= " -type $in{'type'}";
23 $cmd .= " -user $in{'user'}";
26 $cmd .= " -group $in{'group'}";
29 $cmd .= " -size $in{'size'}";
36 open(CMD, "$cmd 2>/dev/null |");
39 if (defined($in{'cont'})) {
40 # Check the file contents for the given pattern
42 if ($f =~ /\.pdf$/i && &has_command("pdftotext")) {
44 open(FILE, "pdftotext -raw ".quotemeta($f)." - |");
50 if (/\Q$in{'cont'}\E/i) {
58 local $rf = &make_chroot($f);
59 local $fil = &file_info_line($f, $rf);
60 print $fil,"\n" if (defined($fil));