Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

testing mac file attributes

by wrinkles (Pilgrim)
on Jan 20, 2012 at 04:54 UTC ( #948885=perlquestion: print w/ replies, xml ) Need Help??
wrinkles has asked for the wisdom of the Perl Monks concerning the following question:

On my mac (10.7) the file conditionals -f and -d and -e give false when the "@" attribute is present. I believe the "@" is used to mark files downloaded from the internet. How do I test these SOBs? TIA
Update: I tried Test::Dir with dir_exists_ok(), which returned "not ok" for the directories with the "@" attribute. I'm still open for suggestions...
#!/usr/bin/env perl use warnings; use strict; use 5.010; my @dirs; my $dh; opendir ($dh, '/home/setup_scripts/mt') or die "Cannot open dir - $!"; @dirs = grep {-d $_} readdir $dh ; print "@dirs \n"; close $dh; opendir ($dh, '/home/setup_scripts/mt') or die "Cannot open dir - $!"; @dirs = readdir $dh ; print "@dirs \n"; close $dh;
Output:
. .. . .. .DS_Store MTOS-4.37-en MTOS-4.37-en.zip
If I change "-d" to "-f" I see this:
.DS_Store . .. .DS_Store MTOS-4.37-en MTOS-4.37-en.zip
Using -e:
. .. .DS_Store . .. .DS_Store MTOS-4.37-en MTOS-4.37-en.zip
mac-pro:setup_scripts wrinkles$ ls -al mt total 11536 drwxr-xr-x 5 wrinkles staff 170 Jan 19 13:22 . drwxr-xr-x 12 wrinkles staff 408 Jan 19 20:32 .. -rw-r--r--@ 1 wrinkles staff 6148 Jan 19 20:04 .DS_Store drwxr-xr-x@ 29 wrinkles staff 986 Jun 21 2011 MTOS-4.37-en -rw-r--r--@ 1 wrinkles staff 5895060 Sep 3 22:22 MTOS-4.37-en.zip

Comment on testing mac file attributes
Select or Download Code
Re: testing mac file attributes
by Anonymous Monk on Jan 20, 2012 at 09:43 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://948885]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2014-12-20 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls