<?php
    $galleryId = $_REQUEST['galleryid']; 
	include("TexStarVSS-dbconnect.php");	
    $sql = sprintf("SELECT * FROM configure WHERE GalleryId = %s", $galleryId);
	$result=mysqli_query($conn, $sql);
	$rows=mysqli_fetch_array($result);
	$files = $rows['Files'];
	include("TexStarVSS-dbdisconnect.php");	
	
	$fromloc = $_REQUEST['fromloc'];
    $fromloc = str_replace('/files', $files, $fromloc);
    $fromloc = str_replace("/", DIRECTORY_SEPARATOR, $fromloc);
    $toloc = $_REQUEST['toloc'];
	$toloc = str_replace('/files', $files, $toloc);
    $toloc = str_replace("/", DIRECTORY_SEPARATOR, $toloc);
    
    if (!is_dir($toloc)) {
         if (!mkdir($toloc, 0, true)) {
             die('Failed to create folders...');
         }
	}
      
   $cmd = "c:\\fastcopy\\fastcopy /cmd=force_copy /speed=full /bufsize=32 /force_close /disk_mode=same /log " . $fromloc . " " . "/to=" . "\"" . $toloc . "\"";
   set_time_limit(240);
   $output = shell_exec($cmd);

   set_time_limit(0);
   echo 1;
?>

