Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File::Find and mounted filesystems

Status
Not open for further replies.

columb

IS-IT--Management
Feb 5, 2004
1,231
EU
I'm running perl under AIX. My simple test script is
Code:
#!/bin/perl -w
use strict;
use File::Find;

sub go
 {
 print "$File::Find::name\n";
 }

find \&go, "/mnt";
i.e. just the basics
I then mount a CD under mnt and it only finds the top level, it does not descend into directories. If I amend the code so that the search path is , for example ".", it works perfectly.

I've Googled this and searched Tec-Tips but cannot find what I'm doing wrong. Any pointers please.

Ceci n'est pas une signature
Columb Healy
 
Is /mnt an operating system command? Can you print the output of an /mnt command? My guess is you are seeing the reults of the /mnt command and not anything File::Find is doing but that is purely a guess.

- Kevin, perl coder unexceptional!
 
Kev, in *nix, there are no drive letters. The root of the file system is / and /mnt is a special directory where removable media get mounted. As in /mnt/cdrom, or /mnt/floppy for example.



Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
I've done some more investigating and, at the end of the day, I may well have to put this down as 'one of those things'
My test script is
Code:
#!/bin/perl -w
use strict;
use File::Find;

sub go
 {
 print "$File::Find::name\n";
 }

find \&go, @ARGV;
i.e. about as basic a find as you can get. I mounted a CD on /mnt and ran the Unix find command which returns
[/code]# find /mnt
/mnt
/mnt/ctl3d.dll
/mnt/datain
/mnt/datain/ctl3d.dll
/mnt/datain/ctl3d32.dll
/mnt/datain/datain.ini
/mnt/datain/dataplus.qaz
/mnt/datain/diwin16.exe
/mnt/datain/diwin16.rev
/mnt/datain/diwin32.exe
/mnt/datain/diwin32.rev
/mnt/datain/master.txt
/mnt/datain.ini
/mnt/datasets.ini
/mnt/didos.exe
/mnt/didos.rev
/mnt/docs
/mnt/docs/changes.htm
/mnt/docs/changes.txt
/mnt/install.exe
/mnt/install.rev
/mnt/master
/mnt/master/master.txt
/mnt/qahisr.dat
/mnt/qahisr.inf
/mnt/qaires.dat
/mnt/qanamx.all
/mnt/readme.txt
/mnt/setup.exe
/mnt/setup.ini
/mnt/setup.rev
/mnt/trace2.std
/mnt/utils
/mnt/utils/quchk.exe
/mnt/utils/quchk.rev
/mnt/utils/quchkd.exe
/mnt/utils/quchkd.rev
/mnt/utils/quchkn.exe
/mnt/utils/quchkn.rev
/mnt/utils/utils.txt
[/mnt] which is exactly what I would expect. (It's a Quick Address data cd BTW). I then ran my script and got
Code:
# /software/QAS/test.pl /mnt
/mnt
/mnt/ctl3d.dll
/mnt/datain
/mnt/datain.ini
/mnt/datasets.ini
/mnt/didos.exe
/mnt/didos.rev
/mnt/docs
/mnt/install.exe
/mnt/install.rev
/mnt/master
/mnt/qahisr.dat
/mnt/qahisr.inf
/mnt/qaires.dat
/mnt/qanamx.all
/mnt/readme.txt
/mnt/setup.exe
/mnt/setup.ini
/mnt/setup.rev
/mnt/trace2.std
/mnt/utils
i.e. it's reading the CD but not recursing into directories.


Ceci n'est pas une signature
Columb Healy
 
Sorry about the double post - I had Friday afternoon finger trouble and clicked on Submit when I wanted to click on Preview.

Anyway, I then tried my script on an NFS mounted filesystem and it worked fine. It would seem to be something to do with the AIX mount system when applied to CDs (i.e -v cdrfs)

Whilst I'd like to solve this for curiosity reasons, as I need to get the code finished I've compromised on

Code:
foreach ( `find /mnt -type f` )

Ceci n'est pas une signature
Columb Healy
 
hoinz
Code:
# perl --version

This is perl, v5.6.0 built for aix
So not that out of date.

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top