Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001

    Question Copy /dir In PHP???

    How do you copy a directory in PHP???? I try it and it turns the directory that I want to copy, to a file!

    This is what I use:

    PHP Code:
    copy("admin/temp_dir"$b_dname); // $b_dname just has a name like 'Social Chat' or such 
    Please help me, thanks...
    - Shawn

  2. #2
    Join Date
    Sep 2002
    Dallas, TX
    Firstly, the copy() function copies only files, not directories.

    Secondly, when copying files, the second parameter is the destination. I'm not entirely sure what the second param you're passing is supposed to be.

    To copy an entire directory, you would have to write a function that uses copy() to copy each file, one by one.

    While I cannot vouch for it, there appears to be just such a function in the online comments section (ie. submitted by a user) of the PHP copy() reference documentation.
    justin 'at'
    Shared Unix Hosting

  3. #3
    Join Date
    Mar 2001
    Yeah, I know you can't use the copy() function for directories, but only for files, but I thought there was a way that you could get by it.
    No, I can't use mkdir() because the OWNERSHIP of the file isn't what I want.

    And I can't use the system() UNIX command for to copy it, because that is disabled in my host's settings.... And so I need something that can get past a lot of security blocks, such as Safe Mode, and Disablation of the UNIX commands.


    - Shawn

Posting Permissions

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