Hi,
Below mentioned script shows the file name whose file type is 33188.
#!/usr/bin/perl -w
use strict;
use File::stat;
sub dodir {
opendir(DIR,$_[0]) or die "Couldn't open $_[0] directory $!";
my $dir=$_[0];
if ( $dir !~ /\/$/ )
{
$dir .= "/";
}
my @List=readdir(DIR);
closedir(DIR);
splice(@List,0,2);
foreach my $file (@List) {
$file = $dir.$file;
if( -d $file) { dodir($file); }
elsif (stat($file)->mode == 33188 ) { print "\n File $file is pre
+sent in $dir";
print "\n File type: ",stat($file)->mode; }
}
}
my $dir_name="/home";
if ( -d $dir_name) {
dodir($dir_name);
}
==============o/p=======
$ ./file_op.pl
Directory name is /home
Directory name is /home/abhosale
Directory name is /home/abhosale/.texmf
Directory name is /home/abhosale/.texmf/config
Directory name is /home/abhosale/.texmf/config/web2c
Directory name is /home/abhosale/.texmf/var
Directory name is /home/abhosale/.texmf/var/fonts
Directory name is /home/abhosale/.texmf/var/fonts/map
Directory name is /home/abhosale/.texmf/var/fonts/map/dvipdfm
Directory name is /home/abhosale/.texmf/var/fonts/map/dvipdfm/updmap
Directory name is /home/abhosale/.texmf/var/fonts/map/dvips
Directory name is /home/abhosale/.texmf/var/fonts/map/dvips/updmap
Directory name is /home/abhosale/.texmf/var/fonts/map/pdftex
Directory name is /home/abhosale/.texmf/var/fonts/map/pdftex/updmap
Directory name is /home/abhosale/.texmf/var/web2c
File /home/first is present in /home/
File type: 33188
Directory name is /home/myprog
File /home/myprog/abc is present in /home/myprog/
File type: 33188
File /home/myprog/abd is present in /home/myprog/
File type: 33188
File /home/myprog/matter is present in /home/myprog/
File type: 33188
File /home/myprog/newfile is present in /home/myprog/
File type: 33188
File /home/myprog/oldfile is present in /home/myprog/
File type: 33188
Originally posted as a Categorized Answer.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|