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
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.