Forum Moderators: coopster

Message Too Old, No Replies

mkdir 777

not able to remove directories anymore

         

ikbenhet1

11:16 am on Feb 17, 2003 (gmt 0)

10+ Year Member



Hello,

-I made a new folder and put the permissions on 777.

-I ran my php code i was working on, which makes folders with mkdir through php and then writes a single .txt file in each folder.
-The command for making the folders i used was:
mkdir($rootdir."/".$pieces[0]."/".$pieces[1], 0777);

I cannot delete these folders anymore for some reason i get a 550 error message. Why? 777 means all permissions right? What's wrong with this then? i should be able to delete this right?

added: Can i delete these folders with a deldir command or so?

jpjones

11:37 am on Feb 17, 2003 (gmt 0)

10+ Year Member



Hi,

A few things I'd check -
A) Does the folder actually exist?

Does the output of :
mkdir($rootdir."/".$pieces[0]."/".$pieces[1]) actually match the directory that is created and that you are trying to remove?

B) Is the folder empty when you try to remove it?

JP

ikbenhet1

11:55 am on Feb 17, 2003 (gmt 0)

10+ Year Member



Yes, the directories have sucsesfully been made, but could it be the problem is that each time i run the programm it tries to make the same directories again each time without checking if they already exist. Can that be the problem?

Some of the directories just don't exist, they are there visually, but when i click it said that it's not there.

But some are clearly theree as i can enter them do, but whem i want to delete it sais no permission,

the directory's are like this:
/777/children/fun/
/777/children/games/
/777/health/care/
/777/health/dentist/
etc.etc.

-The first time i ran the programm i had the permission set to 700, to check if this was the problem i made a new folder an ran the program again with 777, and now still can't delete the directory but now i have 2 unremovable directory's :o.

incywincy

12:03 pm on Feb 17, 2003 (gmt 0)

10+ Year Member



hi,

what delete command did you use? for unix you should use:
rm -r directory-name

this deletes the directory and recursively deletes all files below it.

if you just try:
rmdir directory-name
the command will fail if the directory contains files

hope this helps

ikbenhet1

12:09 pm on Feb 17, 2003 (gmt 0)

10+ Year Member




I delete files by loggin into my ftp account with explorer and then click del.

I also tried wsftp and clicked del no luck.

I will try the rmdir in php to see if that will do the trick.

I guess this has something to do with shared hosting , because i'm not supersupersupervisor over all accounts but just the 'manager' or one account? but i should still be able to delete it..ok off to try the php.

(came back to edit:) some directories do contain 1 .txt file, i can't delete. but im still gonna try what happens.

jpjones

12:33 pm on Feb 17, 2003 (gmt 0)

10+ Year Member



If the rm -rf command does not work, then :

Using WsFTP, if you go log in, and right click -> CHMOD, what happens if you change the directorys to 777, and then try deleting them? Does it let you?

The first time i ran the programm i had the permission set to 700, to check if this was the problem i made a new folder an ran the program again with 777, and now still can't delete the directory but now i have 2 unremovable directory's :o.

If you ran the program again without removing the directories, then the permissions would still be set to 700, as the mkdir command could not create a new directory. Try CHMOD'ding them to 777, remove, and try again.

HTH,
JP

crypto

3:48 am on Feb 18, 2003 (gmt 0)

10+ Year Member



ikbenhet1,

The problem here is that when you create directories using php script, the owner of those dirs/files is apache.
You can check this by your ftp client the owner of the dirs/files should have user-id as 48(which is of apache).
Even if you give 777 permissions to your root dir when u create dir/files using php script they don't get the 777 permissions thats why u can't delete them using ftp client as well. You can delete them by running a php script with rmdir command which removes an empty dir. So first you'll have to empty the directory using unlink command to remove all the files.

jatar_k

5:06 am on Feb 18, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



crypto's got it,

I had the same problem recently. I had to create a little cleaning script while testing because the dir, script and some images and a db are all created by a script.

A couple of unlinks, drops and a rmdir and everything was fine.

marcs

4:19 am on Feb 19, 2003 (gmt 0)

10+ Year Member



Even if you give 777 permissions to your root dir when u create dir/files using php script they don't get the 777 permissions thats why u can't delete them using ftp client as well.

Another approach would be to have your script change permissions to 777 on every new file it creates.

That way you should be able to remove the directory with subdirs and files as you'd have full permissions on them.