niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Perl » modules
skip path prune
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
Author Message
weberw@adelphia.net
*nix forums beginner


Joined: 09 Jul 2006
Posts: 22

PostPosted: Mon Jul 17, 2006 4:34 pm    Post subject: skip path prune Reply with quote

How do you use the prune function to skip a printing all of the
contents of a folder? It will not print folder 3 but does print the
contents of folder 3 which I do not want printed.

#!C://Perl/bin/perl
use CGI ':standard';
use CGI::Carp 'fatalsToBrowser';
#use strict;
use warnings;
use File::Find;
my $file_count = 0;
my $dir_count = 0;


$title = "Find Files";
print header,
start_html($title),
h1($title);

find ( {
wanted => \&wanted}, 'C:/Documents and
Settings/whatever/Desktop/test');

printf "\nThere are %d files in %d directories.\n",
$file_count,
$dir_count;

sub wanted {

if (-d) {

print $File::Find::name, "\n" unless -d =~ /^folder3/;

$dir_count++;
}

elsif (-f _) {
print " <TR> <TD ALIGN=RIGHT>File name is
$File::Find::name</TD></TR><BR></BR>";


$file_count++;

}
}


end_hmtl;
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
The time now is Fri Nov 21, 2008 7:43 pm | All times are GMT
navigation Forum index » Programming » Perl » modules
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts User Environment - export PATH variable paalepu AIX 0 Tue Sep 12, 2006 8:12 pm
No new posts How to set a session cookie with a path? John Drako PHP 1 Thu Jul 20, 2006 7:32 pm
No new posts long path names for ifstream in( Fred J. C++ 1 Thu Jul 20, 2006 2:06 am
No new posts how to use Env variables & its path in ksh shell script dalu.gelu@gmail.com shell 8 Tue Jul 18, 2006 1:12 pm
No new posts skip path prune weberw@adelphia.net Perl 1 Mon Jul 17, 2006 4:34 pm

Mortgage Calculator | ModernForums | Loans | Loans | Masini second hand
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1612s ][ Queries: 16 (0.0728s) ][ GZIP on - Debug on ]