:) You are right about the robustness part..
The directory i made by hand. So no need to create and remove it with
code. And using a test suit to show this simple example seems like a bit
of overkill to me. Just wanted to show directories with spaces
function properly when used with is_dir().
Ro
# [EMAIL PROTECTED] / 2007-02-08 16:14:57 +0100:
> Like Roman said. I also don't see this behaviour.
> Although my test is a lot more simple :)
It's not complete:
> $dir = "test dir";
mkdir($dir);
> if (is_dir($dir)) {
> echo "It's a dir :)";
> }
rmdir($dir);
But even with those two c
Like Roman said. I also don't see this behaviour.
Although my test is a lot more simple :)
On Thu, 08 Feb 2007 17:24:33 +0200, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
> its running on a linux server PHP 4.3.x
>
> What i mean is that the directory name has a space in it eg:
> srv/www/htdocs/si
its running on a linux server PHP 4.3.x
What i mean is that the directory name has a space in it eg:
srv/www/htdocs/site/Broker details/
T.Lensselink wrote:
OS? PHP version?
Tested with PHP4 on Win and *nix : works
On Thu, 08 Feb 2007 16:47:26 +0200, Angelo Zanetti <[EMAIL PROTECTED]>
# [EMAIL PROTECTED] / 2007-02-08 16:47:26 +0200:
> I am reading directories and one of the directories has a space in it so
> when I run:
>
> if (is_dir($dir))
>
> it returns false.
How much space? You need at least 1GB. But seriously, I don't see the
behaviour you mention:
d = $this->mkdtemp(
OS? PHP version?
Tested with PHP4 on Win and *nix : works
On Thu, 08 Feb 2007 16:47:26 +0200, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
> Hi All.
>
>
> I am reading directories and one of the directories has a space in it so
> when I run:
>
> if (is_dir($dir))
>
>
> it returns false. But I
Hi All.
I am reading directories and one of the directories has a space in it so
when I run:
if (is_dir($dir))
it returns false. But I know the folder exists, so is there a way to
force the read? Or what else should I do? rename it and then read it?
Thanks in advance.
--
--
> echo '', var_dump( $_SERVER ), '';
>
> for instance I cut/paste the following from an application of my,
> the code lives in a centrally included file:
>
> /* define a webroot basepath for the datasyncer module */
> define('DS_WEBROOT', realpath(dirname(__FILE__).'/..'));
>
dirname! That's the
Mark Rees wrote:
var_dump (realpath('temp'));
> I am trying to check whether /lists/admin/temp exists (which it does).
This dir doesn't exists. The '/' at the beginning of path means: path is
from root (unix) or from e.g. c:\ (windows)
Outputs from
var_dump(realpath("../../lists/admin/temp")
> > var_dump (realpath('temp'));
> > I am trying to check whether /lists/admin/temp exists (which it does).
>
> This dir doesn't exists. The '/' at the beginning of path means: path is
> from root (unix) or from e.g. c:\ (windows)
>
> Outputs from
>
> var_dump(realpath("../../lists/admin/temp"))
>
Mark Rees wrote:
That outputs (paths trimmed)
string(56) "C:\...\htdocs\lists\admin"
string(61) "C:\...\htdocs\lists\admin\temp"
bool(false)
var_dump (realpath("../../lists/admin/temp"));
this outputs the same as
var_dump (realpath('temp'));
> I am trying to check whether /lists/admin/t
> > > what does the following output:
> > >
> > > var_dump (getcwd());
Sorry, this wasn't clear. I mean it outputs c:\...\htdocs\lists\admin
Not sure about the permissions. I'm using windows 2000, and the 'temp'
directory has the same user permissions as the rest of the htdocs folder
> > what
> > what does the following output:
> >
> > var_dump (getcwd());
This outputs a fully qualified path to the current working directory
(/lists/admin)
Not sure about the permissions. I'm using windows 2000, and the 'temp'
directory has the same user permissions as the rest of the htdocs foler
>
>
Hello
I am having trouble with is_dir
I am trying to check whether /lists/admin/temp exists (which it does).
However, I cannot get the function to work by specifying the path as above -
it only works if I do it relative to the current working directory. So:
--
www.itsagoodprice.com - top-brand
Jochem Maas wrote:
what does the following output:
var_dump (getcwd());
I have better question:
what does the following output:
var_dump (realpath(getcwd()));
var_dump (realpath('temp'));
var_dump (realpath("/lists/admin/temp"));
--
Ondrej Ivanic
([EMAIL PROTECTED])
--
PHP General Mailing
maybe the following helps you (a little):
vlad georgescu wrote:
i have the code below
**
*if ($dir = @opendir("dir2open"))
$path = "dir2open"; // make this into a proper path!
if ($dir = @opendir($path))
{
while($file = readdir($dir)) {
//if (($file!='.') && ($file!='..') && ($file!='.htacce
Mark Rees wrote:
Hello
I am having trouble with is_dir
I am trying to check whether /lists/admin/temp exists (which it does).
However, I cannot get the function to work by specifying the path as above -
it only works if I do it relative to the current working directory. So:
var_dump (is_dir(g
Hello
I am having trouble with is_dir
I am trying to check whether /lists/admin/temp exists (which it does).
However, I cannot get the function to work by specifying the path as above -
it only works if I do it relative to the current working directory. So:
var_dump (is_dir(getcwd()));
var_dump
i have the code below
**
*if ($dir = @opendir("dir2open"))
{
while($file = readdir($dir)) {
//if (($file!='.') && ($file!='..') && ($file!='.htaccess') && ($file!='
index.php')) {
// if (is_dir($file)) { // print just "." & ".."
// if (is_file($file)) { // works fin
Yup! That's the one! I was missing PATH...
:)
Thank you very much for such a nice explanation!
-afan
M. Sokolewicz wrote:
Matt M. wrote:
$path = 'product_images';
$handle = opendir($path);
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
Nope! It doesnt work either...
:(
Matt M. wrote:
$path = 'product_images';
$handle = opendir($path);
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
echo $file;
if (is_dir($file))
{
echo ' <-- folde
Matt M. wrote:
$path = 'product_images';
$handle = opendir($path);
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
echo $file;
if (is_dir($file))
{
echo ' <-- folder';
$folders[] = $fi
> $path = 'product_images';
> $handle = opendir($path);
> while (false !== ($file = readdir($handle)))
> {
> if ($file != "." && $file != "..")
> {
> echo $file;
> if (is_dir($file))
> {
> echo ' <-- folder';
>
I have script that create directories after item's name and each
directory has 2 images: big image and it's thumbnail (both jpgs)
But, when I run this code:
$path = 'product_images';
$handle = opendir($path);
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $
John Nichel wrote:
Chris wrote:
if (is_dir($file) || ($file!=".") || ($file!="..")) continue;
That will match everything and anything, files and dot directories...
The first statement by the OP should work fine. All three will eval
to true if it is a directory, and the directory isn't . or ..
* Thus wrote Mark:
> I'm having a problem I haven't encountered before. I'm using PHP
> 4.3.4 (upgrading the 4.3.9, but humor me) on Windows.
>
> I'm using the following code snippet to try to get all the
> subdirectories of a directory into an array.
>
> $maildir=MERCURY."/MAIL";
> $handle=o
--- Jason Wong <[EMAIL PROTECTED]> wrote:
> On Tuesday 28 September 2004 03:54, Mark wrote:
>
> > With the echos above in place, I get the resource handle, and it
> > echos everything you would expect except that is_dir() fails to
> > recognize the directories.
>
> Because is_dir() expects a pa
Mark wrote:
--- John Nichel <[EMAIL PROTECTED]> wrote:
Chris wrote:
if (is_dir($file) && ($file!=".") && ($file!="..")) {
$users[]=$file;
}
It's only adding it to the array if all 3 of those are true. and
since
$file can't be both '.' and '..' at the same time, it's never
matching.
I'd d
--- Jason Wong <[EMAIL PROTECTED]> wrote:
> On Tuesday 28 September 2004 03:54, Mark wrote:
>
> > With the echos above in place, I get the resource handle, and it
> > echos everything you would expect except that is_dir() fails to
> > recognize the directories.
>
> Because is_dir() expects a pa
--- John Nichel <[EMAIL PROTECTED]> wrote:
> Chris wrote:
> >if (is_dir($file) && ($file!=".") && ($file!="..")) {
> > $users[]=$file;
> >}
> >
> > It's only adding it to the array if all 3 of those are true. and
> since
> > $file can't be both '.' and '..' at the same time, it's n
On Tuesday 28 September 2004 03:54, Mark wrote:
> With the echos above in place, I get the resource handle, and it
> echos everything you would expect except that is_dir() fails to
> recognize the directories.
Because is_dir() expects a path to the file as well, otherwise it would be
trying to l
Chris wrote:
if (is_dir($file) && ($file!=".") && ($file!="..")) {
$users[]=$file;
}
It's only adding it to the array if all 3 of those are true. and since
$file can't be both '.' and '..' at the same time, it's never matching.
I'd do something like:
if (is_dir($file) || ($file!=".") |
if (is_dir($file) && ($file!=".") && ($file!="..")) {
$users[]=$file;
}
It's only adding it to the array if all 3 of those are true. and since $file can't be
both '.' and '..' at the same time, it's never matching.
I'd do something like:
if (is_dir($file) || ($file!=".") || ($file!=".."
I'm having a problem I haven't encountered before. I'm using PHP
4.3.4 (upgrading the 4.3.9, but humor me) on Windows.
I'm using the following code snippet to try to get all the
subdirectories of a directory into an array.
$maildir=MERCURY."/MAIL";
$handle=opendir($maildir);
// echo $handle;
thx for your help !
Since I am the only one who works on the whole server, it´s all my stuff :)
Yeah, but the increasing of the random_ID is surely a good way ..
Will check on that !
thx again ! :))
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
Fo
Forgot a couple of double quotes and the mode for mkdir. Perfectionist, you
see... :-)
Bogdan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PRO
I do the same with is_file() in several scripts and it works just fine
without clearing the cache. Don't know about dirs but I can't see why it may
be different - should use the exact same functions internally.
On a side note, I'd rather recommend using a loop like
This way you have better cont
Hiya !
I am working on a download script right now,
and I have a question about a part of my code:
do
{
$random_ID = rand(10,99);
$download_dir = "$today $random_ID";
if (!@is_dir($download_dir))
mkdir("$download_dir",0777);
}while(@!is_dir($download_dir));
So, I do this loo
I'm developing on Windows, and I have a bit of code that is designed to do a
quick recursive read on a folder. An integral part of this is the use of
the is_dir() function to decide if it should recurse or not.
DoIt('G:\\');
function DoIt($path){
$handle=opendir("$path");
echo "
I have a snipet of code i'm using for a file maintanance program. I have no
idea why but when the main loop repeats, the is_dir function doesn't return
true even though it prints out a directory in the server.
chdir("/certain/place/for/files/");
$handle=opendir(".");
$file=readdir($handle); //to
40 matches
Mail list logo