Cory94bailly Posted May 28, 2008 Share Posted May 28, 2008 My code: <? $date = date('m-d-Y'); mkdir("backups/$date/", 0700); mkdir("backups/$date/fcs/", 0700); mkdir("backups/$date/fcs/admin", 0700); mkdir("backups/$date/fcs/images", 0700); mkdir("backups/$date/fcs/includes", 0700); mkdir("backups/$date/fcs/uploaded", 0700); copy('fcs',"backups/$date/fcs/"); copy('fcs/admin', "backups/$date/fcs/admin/"); copy('fcs/images', "backups/$date/fcs/images/"); copy('fcs/includes', "backups/$date/fcs/includes/"); copy('fcs/uploaded', "backups/$date/fcs/uploaded/"); echo "Task done successfully!"; ?> But I am getting things like: Warning: copy() [function.copy]: The first argument to copy() function cannot be a directory in /home/content/m/a/r/markbailly/html/backupfcs.php on line 10 Warning: copy() [function.copy]: The first argument to copy() function cannot be a directory in /home/content/m/a/r/markbailly/html/backupfcs.php on line 11 Warning: copy() [function.copy]: The first argument to copy() function cannot be a directory in /home/content/m/a/r/markbailly/html/backupfcs.php on line 12 Warning: copy() [function.copy]: The first argument to copy() function cannot be a directory in /home/content/m/a/r/markbailly/html/backupfcs.php on line 13 Warning: copy() [function.copy]: The first argument to copy() function cannot be a directory in /home/content/m/a/r/markbailly/html/backupfcs.php on line 14 How can I get it to copy every file inside the directory to a new one? Thanks guys. Link to comment https://forums.phpfreaks.com/topic/107681-auto-backup/ Share on other sites More sharing options...
corbin Posted May 28, 2008 Share Posted May 28, 2008 List every file and copy it inside a loop... http://php.net/opendir http://php.net/glob One of those should help. Link to comment https://forums.phpfreaks.com/topic/107681-auto-backup/#findComment-552007 Share on other sites More sharing options...
turtleman8605 Posted May 28, 2008 Share Posted May 28, 2008 try something like copy("/path/to/files/*", "/path/to/archived/files/") Link to comment https://forums.phpfreaks.com/topic/107681-auto-backup/#findComment-552010 Share on other sites More sharing options...
Cory94bailly Posted May 28, 2008 Author Share Posted May 28, 2008 try something like copy("/path/to/files/*", "/path/to/archived/files/") Warning: copy(fcs/*) [function.copy]: failed to open stream: No such file or directory in /home/content/m/a/r/markbailly/html/backupfcs.php on line 10 List every file and copy it inside a loop... http://php.net/opendir http://php.net/glob One of those should help. Hmm, I'll need help with that.. Link to comment https://forums.phpfreaks.com/topic/107681-auto-backup/#findComment-552047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.