/    Sign up×
Community /Pin to ProfileBookmark

directory listing from unix/linux server

I have a page that is getting a list of directories and displaying them with links to those directories. As it is right now, it works, but it shows the “.” and “..” directories. How can I not display these directories? Below is a code snippet of how I am getting the directories:

[code]
// directory name
$dir = getcwd();

$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$ignore_regexp = “Chicks_with_Attitudes|CVS|^_vti_|index.php|TEXT.CSS|config.php”;
if (ereg($ignore_regexp ,$filename)) {
continue;
}
$dirs[] = $filename;
$dirnames = str_replace(“_”,” “,$dirs);
}
sort($dirs);
sort($dirnames);

[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@jrthor2authorMay 31.2005 — I got it working
×

Success!

Help @jrthor2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...