rmdir and chmod help for Windows XP Home!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel

    rmdir and chmod help for Windows XP Home!

    Hi,

    From what I read from the PHP manual, chmod on a Windows platform
    should have no effect, and that seems totally normal (unless someone on
    sourceforge has a windows port of that!).

    I create a directory on my Windows box, and set chmod 777 on it (that
    should be full access for everyone if my memory serves me correctly),
    but when I want to rmdir that directory, I get a permission denied
    message (I can delete contents from that directory with no problems, and
    I can create/delete subdirectories either by hand or by script with no
    problems.

    I tried creating a subdirectory with the same name and without the chmod
    in a test script and everything went OK...

    I then commented out the chmod line in my script, and now, directory
    creation and delete works fine!

    So, for PHP on windows (xp home?), chmod 777 makes the file undeletable
    for another PHP script, but not for Windows explorer or the windows/dos
    command line...?!?!

    Anyone got an explanation for this? I'm intrigued!

    Cheers,
    Daniel

  • Steven Musumeche

    #2
    Re: rmdir and chmod help for Windows XP Home!

    chmod and rmdir are UNIX commands which have no effect in a Windows
    environment.

    -Steve

    "Daniel" <daniel@dlpage. com> wrote in message
    news:3f87dfee$0 $8974$79c14f64@ nan-newsreader-03.noos.net...[color=blue]
    > Hi,
    >
    > From what I read from the PHP manual, chmod on a Windows platform
    > should have no effect, and that seems totally normal (unless someone on
    > sourceforge has a windows port of that!).
    >
    > I create a directory on my Windows box, and set chmod 777 on it (that
    > should be full access for everyone if my memory serves me correctly),
    > but when I want to rmdir that directory, I get a permission denied
    > message (I can delete contents from that directory with no problems, and
    > I can create/delete subdirectories either by hand or by script with no
    > problems.
    >
    > I tried creating a subdirectory with the same name and without the chmod
    > in a test script and everything went OK...
    >
    > I then commented out the chmod line in my script, and now, directory
    > creation and delete works fine!
    >
    > So, for PHP on windows (xp home?), chmod 777 makes the file undeletable
    > for another PHP script, but not for Windows explorer or the windows/dos
    > command line...?!?!
    >
    > Anyone got an explanation for this? I'm intrigued!
    >
    > Cheers,
    > Daniel
    >[/color]


    Comment

    • Daniel

      #3
      Re: rmdir and chmod - I don't agree with you Steven!!!

      Chmod *should not* work, but it does somthing (I have no problems after
      desactivating it), and rmdir has been a DOS command since MS-DOS v2 -
      It's better known alias in the DOS world is "rd" (just as md & mkdir and
      cd & chdir all work on your DOS and Windows command lines...)

      As I mentionned, as soon as I commented out the chdir 777 on the
      directory that I made with the script x, script y could delete it. When
      I uncomment the chdir instruction and re-executed the script x, the
      directory delete with script y gives me permission denied messages...

      If you want, I can post code...

      - Daniel (Who is still confused... :-)





      Steven Musumeche wrote:[color=blue]
      > chmod and rmdir are UNIX commands which have no effect in a Windows
      > environment.
      >
      > -Steve
      >
      > "Daniel" <daniel@dlpage. com> wrote in message
      > news:3f87dfee$0 $8974$79c14f64@ nan-newsreader-03.noos.net...
      >[color=green]
      >>Hi,
      >>
      >> From what I read from the PHP manual, chmod on a Windows platform
      >>should have no effect, and that seems totally normal (unless someone on
      >>sourceforge has a windows port of that!).
      >>
      >>I create a directory on my Windows box, and set chmod 777 on it (that
      >>should be full access for everyone if my memory serves me correctly),
      >>but when I want to rmdir that directory, I get a permission denied
      >>message (I can delete contents from that directory with no problems, and
      >>I can create/delete subdirectories either by hand or by script with no
      >>problems.
      >>
      >>I tried creating a subdirectory with the same name and without the chmod
      >>in a test script and everything went OK...
      >>
      >>I then commented out the chmod line in my script, and now, directory
      >>creation and delete works fine!
      >>
      >>So, for PHP on windows (xp home?), chmod 777 makes the file undeletable
      >>for another PHP script, but not for Windows explorer or the windows/dos
      >>command line...?!?!
      >>
      >>Anyone got an explanation for this? I'm intrigued!
      >>
      >>Cheers,
      >>Daniel
      >>[/color]
      >
      >
      >[/color]

      Comment

      • Andy Hassall

        #4
        Re: rmdir and chmod - I don't agree with you Steven!!!

        On Sat, 11 Oct 2003 16:57:40 +0200, Daniel <daniel@dlpage. com> wrote:
        [color=blue]
        >Chmod *should not* work, but it does somthing (I have no problems after
        >desactivatin g it), and rmdir has been a DOS command since MS-DOS v2 -
        >It's better known alias in the DOS world is "rd" (just as md & mkdir and
        >cd & chdir all work on your DOS and Windows command lines...)[/color]

        There is actually a function _chmod in the Windows C runtime library, that
        appears to closely matches the Unix equivalent.



        Not really clear how it'd interact with NTFS permissions though.

        --
        Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
        Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

        Comment

        • Daniel

          #5
          Re: rmdir and chmod - I don't agree with you Steven!!!

          A quick example for anyone who wants to try...

          (do not enter x. for the line numbers O:-) )

          1. mkdir("c:/PHPquickdirtest 1");
          2. chmod("c:/PHPquickdirtest 1", 777);
          3. rmdir ("c:/PHPquickdirtest 1");
          4. mkdir("c:/PHPquickdirtest 2");
          5. rmdir ("c:/PHPquickdirtest 2");

          Line 3 gives me a permission denied error. Line 5 works perfectly.
          If I comment out line 2, lines 3 (and 5 of course) works perfectly.

          This is under XP Home... Anyone care to try under a different version of
          'Doze ?

          Cheers,
          Daniel

          Andy Hassall wrote:[color=blue]
          > On Sat, 11 Oct 2003 16:57:40 +0200, Daniel <daniel@dlpage. com> wrote:
          >
          >[color=green]
          >>Chmod *should not* work, but it does somthing (I have no problems after
          >>desactivati ng it), and rmdir has been a DOS command since MS-DOS v2 -
          >>It's better known alias in the DOS world is "rd" (just as md & mkdir and
          >>cd & chdir all work on your DOS and Windows command lines...)[/color]
          >
          >
          > There is actually a function _chmod in the Windows C runtime library, that
          > appears to closely matches the Unix equivalent.
          >
          > http://msdn.microsoft.com/library/de...c_._wchmod.asp
          >
          > Not really clear how it'd interact with NTFS permissions though.
          >
          > --
          > Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
          > Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)[/color]

          Comment

          • Daniel

            #6
            rmdir and chmod under windows XP - solution &amp; bug

            Solution :
            -----------
            First of all, the current mkdir command needs to have an access mode
            specified... this is not the case so:

            mkdir("c:/PHPquickdirtest 1");
            becomes
            mkdir("c:/PHPquickdirtest 1", 0777);

            This is not really a problem, though a this must depend on your version
            of PHP, as on my home programming box, the first line is OK, but a
            version under Windows NT 4 running a different version, the second line
            is the only one valid.

            Secondly, PHP needs the leading 0 for any mode access, so

            chmod("c:/PHPquickdirtest 1", 777);
            becomes
            chmod("c:/PHPquickdirtest 1", 0777);

            From here, I can access directories and delete them without any
            problems. rmdir and chmod problems solved.

            Bug :
            -----
            On my NT 4 test box, after doing a chmod 777, the directory was created,
            and when I wanted to delete by hand, there was a Windows error message
            "This folder is a read-only folder. Are you sure"... chmod 777 sets the
            read-only attribute!
            Under Windows XP Home, the directory is also read-only - the bug is that
            when you delete it by hand, there is no warning of this attribute! -
            Just the plain old Windows "are you sure" message... If you do not think
            to do a right-click > properties, you will never know what directories
            are standard and what are read-only when you delete them by hand, so the
            protections provided by the read-only attribute are no longer a
            protection... Well done Bill!

            Cheers, and thanks for all your help,

            Daniel


            Daniel wrote:[color=blue]
            > A quick example for anyone who wants to try...
            >
            > (do not enter x. for the line numbers O:-) )
            >
            > 1. mkdir("c:/PHPquickdirtest 1");
            > 2. chmod("c:/PHPquickdirtest 1", 777);
            > 3. rmdir ("c:/PHPquickdirtest 1");
            > 4. mkdir("c:/PHPquickdirtest 2");
            > 5. rmdir ("c:/PHPquickdirtest 2");
            >
            > Line 3 gives me a permission denied error. Line 5 works perfectly.
            > If I comment out line 2, lines 3 (and 5 of course) works perfectly.
            >
            > This is under XP Home... Anyone care to try under a different version of
            > 'Doze ?
            >
            > Cheers,
            > Daniel
            >
            > Andy Hassall wrote:
            >[color=green]
            >> On Sat, 11 Oct 2003 16:57:40 +0200, Daniel <daniel@dlpage. com> wrote:
            >>
            >>[color=darkred]
            >>> Chmod *should not* work, but it does somthing (I have no problems
            >>> after desactivating it), and rmdir has been a DOS command since
            >>> MS-DOS v2 - It's better known alias in the DOS world is "rd" (just as
            >>> md & mkdir and cd & chdir all work on your DOS and Windows command
            >>> lines...)[/color]
            >>
            >>
            >>
            >> There is actually a function _chmod in the Windows C runtime library,
            >> that
            >> appears to closely matches the Unix equivalent.
            >>
            >> http://msdn.microsoft.com/library/de...c_._wchmod.asp
            >>
            >>
            >> Not really clear how it'd interact with NTFS permissions though.
            >>
            >> --
            >> Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
            >> Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)[/color]
            >
            >[/color]

            Comment

            Working...