Tuesday, June 7, 2011

Test data creation script -- By Awadhesh

Below are the requirements for the Script.

Parameters:

1. Source Location

2. Destination Location

3. Start date

4. End date

5. Provider

6. Brand

7. Number of files (Ex: 1000)

8. File Size

9- Story date

10. Log

11- Language (One OR Many)

Below is given a script program for copy the source directory Documents to Destination .

$src_dir="/entixd/PhpTraining/20110511/CyberAlert/";

$dest_dir="/entixd/PhpTraining/work/";

$d=@opendir($src_dir);

if(!$d)die('The directory ' .$src_dir .' does not exists or PHP have no access to it.');

while(false!==($file=@readdir($d))){

if(is_file($src_dir.$file)){

if(is_dir($dest_dir)){

copy($src_dir.$file,$dest_dir.$file);

} else {

die("Destination Directory ".$dest_dir." does not exist");

}

}

}

?>

--

No comments:

Post a Comment