We help IT Professionals succeed at work.
Get Started

Want to move files from folder1 to folder2, except upload.php and getfile.html

cunoc asked
Last Modified: 2012-05-09
Hi all Experts,
It works great in my "localhost" and failed when I placed it in my server (files are not copy - and no error or sucessful message or anything). Source and Destination in my domain are the same as in my localhost, so it is not a case that the source and destination are mispelling.

My purpose is to move all files in "folder1" to "folder2", (except upload.php and getfile.html) - leave those files in folder1 as they were.

Any help from you all. Thanks
$so = 'folder1/';
$de = 'folder2/';

if ($open = opendir($so))
  while (false !== ($file = readdir($open)))
    if ($file != '.' && $file != '..')
       rename("$so/$file", "$de/$file");
       echo("Sucessfully move $so/$file to $de/$file<br />");
Watch Question
This problem has been solved!
Unlock 8 Answers and 15 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE