diff --git a/html/inc/bu-common.php b/html/inc/bu-common.php index c21a667..70a8a0f 100644 --- a/html/inc/bu-common.php +++ b/html/inc/bu-common.php @@ -95,6 +95,16 @@ $bu_type = $row[4]; $bu_rnng = $row[5]; + // To ensure uniqueness, we add the backup ID on the end of the path as a subdirectory. + $bu_dest = "$bu_dest/bu_$buid"; + + // Make sure that the directory exists + if( !file_exists($bu_dest) ) { + if( false===mkdir( $bu_dest, 0777, true )){ + return "Failed to create directory $bu_dest"; + } + } + // NOTE: // using pcntl_fork() was a waste of time because the parent always waited for the child to finish. // so we rely on bash &