# C# name files incrementally

**URL:** <https://forum.kirupa.com/t/c-name-files-incrementally/298401>\
**Category:** programming\
**Created:** [October 18, 2009, 10:46am UTC](https://forum.kirupa.com/t/c-name-files-incrementally/298401 "2009-10-18T10:46:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![speedy\_rudolf](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@speedy\_rudolf](https://forum.kirupa.com/u/speedy_rudolf)\
**Post date:** [October 18, 2009, 10:46am UTC](https://forum.kirupa.com/t/c-name-files-incrementally/298401/1 "2009-10-18T10:46:18Z")

</div>

Hi. Can someone tell me how to name files incrementally.  
For example, I’m trying to make an app that downloads once a day a file from the same site. The problem I’m facing is: I want to name the files that are downloaded something like this day1.jpg, day2.jpg, day3.jpg etc. I already did most of the code…I just need to name the files properly…

```auto
 
private void timer1_Tick(object sender, EventArgs e)
{
i = i + 1;
if (i == 3600)
{
WebClient Download = new WebClient();
Download.DownloadFile("http://www.csharpfriends.com/Members/index.aspx", "C:/Users/Rudolf/Pictures/day"a".jpg");
Date_update();
a = a + 1;
i=0;
}
}

```

[SIZE=2]  
[SIZE=2][SIZE=2][COLOR=black]a and i are declared globally, a starts at 1, i at 0, the timer is updated once a minute, that isn’t the site it will download from (I will copy the correct link later), date\_update is already done and working great, and all that needs to be done is naming the file correctly.[/COLOR][/SIZE]  
[SIZE=2][COLOR=black]So…anyone know to do this?[/COLOR][/SIZE]  
[SIZE=2][COLOR=black]Also, if the image is linked to through a php page (I mean, the page is a php page which only contains an image (just the image, there is no text or anything else) which is replaced on a daily basis), can C# download the image, not the php? And if the image is jpg, can C# save it as bmp?[/COLOR][/SIZE]  
[SIZE=2][COLOR=black]Thank you in advance. Bye.[/COLOR][/SIZE][/SIZE][/SIZE]
