C # batch renaming of Files

Source: Internet
Author: User

In fact, this small program is only used to better solve the problems encountered. What problems?

Currently, I am working on image processing. I used CCD to take hundreds of images in batches and named them 1.bmp, 2.bmp, and 3.bmp... , In order, because some images are blurred or non-conforming

Condition, I manually remove it, so with the problem mentioned just now, a large number of image file names are not continuous, and it is not convenient to use Matlab for processing. So I wrote a C # applet to automatically arrange images.

I'm a cainiao. If you have better solutions and algorithms, please advise me a lot. The Code is as follows:

Code
 1 using System;
2 using System. Collections. Generic;
3 using System. Text;
4 using System. IO;
5 using System. Windows. Forms;
6 // automatically rename
7 namespace renamebmp
8 {
9 class Program
10 {
11 static void Main (string [] args)
12 {
13 int first = 1; // start Image number
14 int last = 301; // end image number
15 int temp;
16 string path1; // The first empty position found
17 string path2; // the path of the image file with the minimum serial number after the empty position found
18 int count = 0; // number of images
19 string temppath = "";
20 for (int k = first; k <= last; k ++)
21 {
22 temppath = "F: \ test6 \" + k. ToString () + ". bmp ";
23 if (File. Exists (temppath ))
24 count ++;
25}
26 for (int I = first; I <= count; I ++)
27 {
28
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.