Say I've got a file test.php
in foo
directory as well as bar
. How can I replace bar/test.php
with foo/test.php
using PHP
? I'm on Windows XP, a cross platform solution would be great but windows preferred.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You can copy and past this will help you
If you want to copy multiple or (unlimited files) visit link: http://www.phpkida.com/php-tutorial/copy-multiple-files-from-one-folder-to-another-php/
Hi guys wanted to also add on how to copy using a dynamic copying and pasting.
let say we don't know the actual folder the user will create but we know in that folder we need files to be copied to, to activate some function like delete, update, views etc.
you can use something like this... I used this code in one of the complex project which I am currently busy on. i just build it myself because all answers i got on the internet was giving me an error.
I think facebook or twitter uses something like this to build every new user dashboard dynamic....
Best way to copy all files from one folder to another using PHP
copy will do this. Please check the php-manual. Simple Google search should answer your last two questions ;)
You can use both rename() and copy().
I tend to prefer to use rename if I no longer require the source file to stay in its location.
You could use the
copy()
function :Quoting a couple of relevant sentences from its manual page :