Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts

    deleteing directories

    How can I delete files that were made by the server in ftp? Everytime I try I get "Permission denied". Do I have to delete them by a script or something? I've tried everything I can think of. Changing permissions, changing chmod, etc

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,081
    Thanks
    11
    Thanked 99 Times in 97 Posts
    yes you will need to use a script to delete the files , or change the ownership of the files, & since some hosts wont let you CHOWN then deletion is probably easiest.

    <?
    unlink('filename.file');
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    oops, I meant a whole directory, which has loads of other directories, not files.

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    I've tried renaming and unlinking, both come up with permission denied.

    Warning: Rename failed (Permission denied) in /home/chatterspics/public_html/clear.php on line 3

    The directories are chmoded to 777, if that helps

  • #5
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    www.php.net/rmdir

    Try that

    Jee
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #6
    New Coder
    Join Date
    Jun 2002
    Location
    Paris, France
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess You probably need to have all files in your directory to be correctly chmodded...
    I don't suffer from insanity, I enjoy every single minute of it!

  • #7
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,081
    Thanks
    11
    Thanked 99 Times in 97 Posts
    hmmm OK - you can try this BUT BE VERY CAREFUL!!!!!

    exec('rm -f -R thisdirectory');

    and I mean careful cos if you get this wrong you get it wrong bigtime! that should remove the directory and all its contents including subdirectories.

    again BE CAREFUL !!
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #8
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Ok, I execute that in the directory I want to delete, or name "thisdirectory" to the directory I want to delete? I don't wanna mess it up :s

  • #9
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    That didn't delete anything :s

  • #10
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Just trie everything on this page

    http://www.php.net/manual/en/function.rmdir.php

    Nothing worked.

  • #11
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My host told me that this has to do with the PHP script not "running as user". They say that you want to use a perl script to perform these kinds of operations (especially if you dont want the directory to have universal write access). Does this make sense? Is it possible to call a perl script from a php script in order to perform some of these sensitive operations, or is that a mistake?

    G

  • #12
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I finally got this to work. Again, on my host, php does not run with the authority needed to do deletes, renames, etc. So in my php script, I set up a call to a cgi written in perl that handles those actions. It works.

    G


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •