Camera Shield only lets you save 1 file. How to save multiple files?

So I am trying to get the camera shield from radio shack to work. It’s all connected and set up. The only issue is when the motion detector on the shield is sensed, it takes a picture. I there is already a picture file on there, it deletes the old one. It is under the file name temp.jpg. I need help with the code for making multiple files.

Here is original code (from Github site). It is only a section of the whole thing.
I know the issue is the top few lines. Where it says if file exists already, delete it. Just don’t how what to write. I tried what “RoboJoe” said on http://forum.arduino.cc/index.php?topic=153709.0 but no success.

void capture_photo(){	
	
	// Check to see if the file exists: 
	 if exists,delete the file: REALLY??? I want more than one image
	if(sd.exists("temp.jpg")) sd.remove("temp.jpg");
		
	// open a new empty file for write at end like the Native SD library
	 if (!myFile.open("temp.jpg", O_RDWR | O_CREAT | O_AT_END)) {
	   sd.errorHalt("opening temp.jpg for write failed");
// close the file:
	 myFile.close();

	VC0706_compression_ratio(63);
	delay(100);

	VC0706_frame_control(3);
	delay(10);
	
	VC0706_frame_control(0);
	delay(10);
	rx_ready=false;
	rx_counter=0;
	
	Serial.end();			// clear all rx buffer
	delay(5);
	
	Serial.begin(115200);

	//get frame buffer length
	VC0706_get_framebuffer_length(0);
	delay(10);
	buffer_read();

	//while(1){};
	
	// store frame buffer length for coming reading
	frame_length=(VC0706_rx_buffer[5]<<8)+VC0706_rx_buffer[6];
	frame_length=frame_length<<16;
	frame_length=frame_length+(0x0ff00&(VC0706_rx_buffer[7]<<8))+VC0706_rx_buffer[8];

	vc_frame_address =READ_DATA_BLOCK_NO;
		
	myFile.open("temp.jpg", O_RDWR);	
	while(vc_frame_address<frame_length){	
		VC0706_read_frame_buffer(vc_frame_address-READ_DATA_BLOCK_NO, READ_DATA_BLOCK_NO);
		delay(9);

		//get the data with length=READ_DATA_BLOCK_NObytes 
		rx_ready=false;
		rx_counter=0;
		buffer_read();

		// write data to temp.jpg
		myFile.write(VC0706_rx_buffer+5,READ_DATA_BLOCK_NO);
	
		//read next READ_DATA_BLOCK_NO bytes from frame buffer
		vc_frame_address=vc_frame_address+READ_DATA_BLOCK_NO;
	
		}

	// get the last data
	vc_frame_address=vc_frame_address-READ_DATA_BLOCK_NO;

	last_data_length=frame_length-vc_frame_address;

	
	VC0706_read_frame_buffer(vc_frame_address,last_data_length);
	delay(9);
	//get the data 
	rx_ready=false;
	rx_counter=0;
	buffer_read();
			
	myFile.write(VC0706_rx_buffer+5,last_data_length);
	
	myFile.close();

    }}

#endif		 }

You can't have two files with the same name in the same folder on the same drive. You know this don't you?

So you'll need to create a new file name for each picture.

@delta_G

Thank you for the response. Sorry if i wasn't completely clear. I understand that you can't have the same file names; I am looking to save files as picture_01, picture_02, etc. Just now sure how to write the code for that. Would you?

replace "temp.jpg" with a variable string that you can alter with each picture.

It isn't entirely clear how to accomplish that from only your small snippet of code. If you know how to use google, there are tons of examples on the internet of how to create an incrementing file name or even a file name with a date-time stamp.

this is what a previous post used. What could I use from this?

char myFileName[16]; int myFileNr=1;

// create a new file each and every time while (myFileNr != 0) { sprintf(myFileName, "CCC%03d.jpg", myFileNr); if (sd.exists(myFileName) == false) break; myFileNr++; }

// open a new empty file for write at end like the Native SD library if (!myFile.open(myFileName, O_RDWR | O_CREAT | O_AT_END)) { sd.errorHalt("opening ???.jpg for write failed");

Well you certainly can't use that smiley face. How about some code tags so the code is readable.

Are you wanting me to do this for you (I'd want to be paid then) or do you want to give it a try and come back with some code?