Below is the code I have so far and notes of what I am trying to do
<?php
$query2 = "SELECT auto_id,photo_name from friend_user_photo";
$result2 = mysql_query($query2) or die(mysql_error());
while($row1 = mysql_fetch_array($result2)){
$pic = $row1[photo_name];
// I need to find matches where $pic starts with '1/'
// I need to move the files associated with this match to folder 2
// there will be 3 files for each match example is
// 1/16659921546a39293e387cCraig_thumb1.jpg
// 1/16659921546a39293e387cCraig_thumb.jpg
// 1/16659921546a39293e387cCraig.jpg
//so new location will be
// 1/2/16659921546a39293e387cCraig_thumb1.jpg
// 1/2/16659921546a39293e387cCraig_thumb.jpg
// 1/2/16659921546a39293e387cCraig.jpg
$pic = str_replace("1/", "1/2/", $pic);
echo $pic;
echo '<BR>';
$file1 = $pic;
$file2 = $pic; // needs to add _thumb before the .
$file3 = $pic; // needs to add _thumb1 before the .
$newfile1 = '1/$file';
$newfile2 = '1/$file'; // needs to add _thumb before the .
$newfile3 = '1/$file'; // needs to add _thumb1 before the .
copy($file1, $newfile1);
copy($file2, $newfile2);
copy($file3, $newfile3);
$pic = $row1[pic];
$sql="Update friend_fansign set pic='2/$pic' WHERE autoid=$row1[autoid]";
$result=executequery($sql);
}
?>