when moving one file from one location to another i use
rename('path/filename', 'newpath/filename');
how do you move all files in a folder to another folder? tried this one without result:
rename('path/*', 'newpath/*');
Select Them All It's the same as it is in any word processor: Ctrl + A. You'll see all of your files in the current window, or your desktop, selected. Just drag them where you want and you're all set.
To move one or more files: MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination To rename a directory: MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2 [drive:][path]filename1 Specifies the location and name of the file or files you want to move. destination Specifies the new location of the file.
You can automatically move files from one folder to another by using a script that uses Robocopy, a command-line utility which comes with Windows 10. To automated file transfer, you need to use Robocopy script, add frequency in days, source and destination folder paths.
A slightly verbose solution:
// Get array of all source files $files = scandir("source"); // Identify directories $source = "source/"; $destination = "destination/"; // Cycle through all source files foreach ($files as $file) { if (in_array($file, array(".",".."))) continue; // If we copied this successfully, mark it for deletion if (copy($source.$file, $destination.$file)) { $delete[] = $source.$file; } } // Delete all successfully-copied files foreach ($delete as $file) { unlink($file); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With