Do you ever face an issue to move site from one server to another and your client only provided you FTP login. If your answer is “Yes” continue reading.
I recently working with a picky clients he is very security concerned and he is not interested to provide me his server login. He only provided me the FTP login. I want tranfer site files one his new server from old one.
I manage this via this code in php. I create a php file with this code and run this code via browser and ‘tada’ i can see a zip file with all files ziped I juts downloaded it and move to new server and extracted tehre uisng the file manager that already have.
<? // increase script timeout value ini_set("max_execution_time", 300); // create object $zip = new ZipArchive(); // open archive if ($zip->open("my-archive.zip", ZIPARCHIVE::CREATE) !== TRUE) { die ("Could not open archive"); } // initialize an iterator // pass it the directory to be processed $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("vantage/")); // iterate over the directory // add each file found to the archive foreach ($iterator as $key=>$value) { $zip->addFile(realpath($key), $key) or die ("ERROR: Could not add file: $key"); } // close and save archive $zip->close(); echo "Archive created successfully."; ?>