473,750 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 17 '05 #1
5 16813
chmod and rmdir are UNIX commands which have no effect in a Windows
environment.

-Steve

"Daniel" <da****@dlpage. com> wrote in message
news:3f******** **************@ nan-newsreader-03.noos.net...
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

Jul 17 '05 #2
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:
chmod and rmdir are UNIX commands which have no effect in a Windows
environment.

-Steve

"Daniel" <da****@dlpage. com> wrote in message
news:3f******** **************@ nan-newsreader-03.noos.net...
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



Jul 17 '05 #3
On Sat, 11 Oct 2003 16:57:40 +0200, Daniel <da****@dlpage. com> wrote:
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...)


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 (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #4
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:
On Sat, 11 Oct 2003 16:57:40 +0200, Daniel <da****@dlpage. com> wrote:

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

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 (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


Jul 17 '05 #5
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:
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:
On Sat, 11 Oct 2003 16:57:40 +0200, Daniel <da****@dlpage. com> wrote:

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


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 (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)



Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6205
by: Alex Kouzemtchenko | last post by:
ok, I've got a peice of code that deletes folders, wether empty or non-empty and I keep getting these errors: Warning: rmdir(./modules/test/Copy of test/Random Folder) : Permission denied in c:\webdesign\fms\modules\functions.php on line 44 Warning: rmdir(./modules/test/Copy of test) : Directory not empty in c:\webdesign\fms\modules\functions.php on line 52
1
4697
by: Xuan Yuan | last post by:
I'm using Windows XP Professional and have no FTP installed. Instead, I use Command Promt. I need to CHMOD a PHP file, so I type "CHMOD 775 file-path",but get "'CHMOD'is not recognized as an internal or external command,operable program or batch file"!Is this because I spelled it wrong?Or is it the computer's problem?
5
9552
by: Stewart | last post by:
Hi, I'm working on a program in VC++ right now that needs to set file permissions of a given file to 766 (read/write/execute). Now I've found the _chmod() function in the API help docs, but that only caters for read/write. Is there ANY way of setting 766 to a file through C++ at all? Many thanks. Mike
2
2914
by: Freebird | last post by:
Hello everyone, =] I need your help, I'm creating a script that will work in many servers, and there's this part, where you can update a list, so the script goes from the client's machine to the central server, opens the file, and in adda line by line in the client server, it's all working fine, but there's a problem, this list, can't be available to others, because if I do this:
47
3318
by: frizzle | last post by:
Hi, I am at the base of an FTP thingy i'm building, and i noticed that it would only work if i chmod the folder 777, i thought to remember correctly that previously on another site chmod 744 was enough, now it isn't. Am i mistaking, and should it always be 777 ? And isn't a chmodded 777 folder much more vulnerable? Frizzle.
3
4766
by: Rik | last post by:
Hello, first of all, my provider sucks, newsserver is down for the #nth time now, offcourse when I have an urgent question.... So this will be me first time using Google Groups, forgive me if something goes wrong. The problem at hand: In a restricted area I let a user upload an image, no problem The image gets scaled down with imagecopyresampled(), and stored with imagejpeg($resized_img,'/path/to/target/image.jpg')
1
14063
by: lakshmi1 | last post by:
#include<stdio.h> #include<unistd.h> Hi, when i execute the following code both lakshmi and sri gets printed,later if i give pwd in the path /home/tcsbasr/CFILES the following statement is displayed. "pwd: cannot determine current directory!"
3
3548
by: royG | last post by:
hi i am checking if a directory exists and if it does i want to delete it and its contents.then i want to create the directory before creating files in it. def myfolderops(): testdir='..\mytestdir' #if dir exist remove it if isdir(testdir): rmdir(testdir)
3
10705
by: mamul | last post by:
Hi All, Can some one help me how to delete a complete directory containing files and folders. I can use system() command but i want use rmdir() and calling it recusively to delete the complete directory structure. please if some one know how to work on both in windows and linux to work on rmdir() plz reply me, Thanks .
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9338
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.