Page 1 of 1

A few questions on files and folders

Posted: Thu May 26, 2005 3:54 am
by Ruski
hi,

I was just searching on the web how to do these things but couldnt find anything :( hope someone helps.
I wanted to know how to:

- Delete a folder
- Set permission so I am able to create new folders
- Renaming folders
- Creating new files(like on a cPanel)

and I think thats about it :D

Thanks in advance

Posted: Thu May 26, 2005 3:58 am
by Chris Corbyn
Delete a folder:

rmdir()

Set permissions:

chmod()

Rename folder:

rename()

New files:

fopen() <-- use w+

:)

Posted: Thu May 26, 2005 4:01 am
by Ruski
Thank you very much, very helpfull :)

Posted: Thu May 26, 2005 4:06 am
by Ruski
Another question

when i tryed to create a new directory it came up with a permission erro:

Warning: mkdir(/home/ruski/public_html/hello): Permission denied in /home/ruski/public_html/create.php on line 3

Which permission is that?

well....

Posted: Thu May 26, 2005 4:11 am
by rochakchauhan
If you are on unix system, make sure that you have write permission to directory where you are trying to create this directory.
and the Code is :

Code: Select all

mkdir("dirName", 0777); // this will give all rights to the new folder

Posted: Thu May 26, 2005 4:14 am
by Ruski
<?php

mkdir("/home/ruski/public_html/host/hello",777);

?>

That is what ive got and I still get the permission error, ive the set the directory permissions to where I want to create a new folder to 777 and still the same.

Thanks

Posted: Thu May 26, 2005 4:21 am
by Ruski
Never mind i got it working :D

I had to set the php file permission to 777 the one that I was running to make the new directory.

Thanks for all the help