Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:50:56+00:00 2026-06-04T12:50:56+00:00

static void Main(string[] args) { int a=0000001; for (int i=0; i <= 5; i++)

  • 0
static void Main(string[] args)
{
    int a=0000001;
    for (int i=0; i <= 5; i++)
    {

        File.Copy(@"C:\SR\30758668.pdf", @"C:\SR\"+a+"_30758668.pdf",true);
        a++;
    }

    Console.WriteLine("\nSuccessful");
    Console.ReadLine();

}

I’ve written above program to copy 1 file 5 times with leading string.
like this file 30758668.pdf should be created as 0000001_30758668.pdf,0000002_30758668.pdf`,0000003_30758668.pdf` like wise.

now its creating files with 1_30758668.pdf and 2_30758668.pdf I don’t want this way.

I’m not getting where to convert to integer or string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:50:59+00:00Added an answer on June 4, 2026 at 12:50 pm

    And int does not have formatting; 01 is the same as 1 is the same as 00000001 – they are all just 1.

    Use:

     .... + a.ToString().PadLeft(7,'0') + ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

static void Main(string[] args) { int test = 1; resetTest(); Console.Write(test); // Should be
Consider following program: static void Main (string[] args) { int i; uint ui; i
I have some code static void Main(string[] args) { int j = 0; for
public class Sample { public static void main(String[] args) { int year = 2012;
public class I { public static void main(String args[]) { int i=0,j=1,k=2; i=i++ -
class Program { internal delegate int CallBack(int i); static void Main(string[] args) { CallBack
static void Main(string[] args) { //read in the file StreamReader convert = new StreamReader(../../convert.txt);
public static void main(String[] args) { int [][]shatner = new int[1][1]; int []rat =
public static void main(String[] args) { int x = 1 + + + +
{ class Program { static void Main(string[] args) { int id = 0, stock

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.