Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to increment the folder number if the target number is already in used.
Example I number a folder to IMG0001 but when exported to a directory this folder already exist. Basically the code should increment the folder number to the next available number, like IMG0002 and if this was already in use too the program will increment by one again until the code find a available number to name the folder.
In this way a duplicate folder numbering be avoided.


Thank you very much for any input for my question.
Posted
Updated 6-Dec-12 17:16pm
v2

1 solution

You can create folder
By this Code
C#
System.IO.Directory.CreateDirectory(Server.MapPath("~/IMG000" + i + ""));

You can increment i as per Your Logic
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900