Computing.Net > Forums > Programming > Daily Batch file to create new fold

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Daily Batch file to create new fold

Reply to Message Icon

Name: JamieB
Date: June 5, 2008 at 06:51:54 Pacific
OS: XP
CPU/Ram: 1Gb
Product: Dell
Comment:

I need a batchfile to create a new folder daily. The folder is named using the same naming convention every day, the number just increases by 1.

Ex:

Folder001
Folder002
Folder003

This goes on until we reach Folder999, then it goes back to Folder001.

Can anyone point me in the right direction.

I am using the NT Command Prompt.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: June 5, 2008 at 08:25:44 Pacific
Reply:

The below batch does the job saving the last generated number into FNUM.TXT in the batch folder. You have to edit the statement

MD "Folder%N%"

replacing Folder with your naming convention.

:: FNUM.BAT Usage: FNUM
@echo off
if not exist %~dpn0.txt (
set N=1
) else (
set /P N=<%~dpn0.txt
)
set M=%N%
if %M% lss 100 set N=0%N%
if %M% lss 10 set N=0%N%
MD "Folder%N%"
set /A M+=1
if %M% gtr 999 set M=1
Echo.%M%> %~dpn0.txt
for %%j in (N M) do set %%J=
:: End_Of_Batch


0

Response Number 2
Name: JamieB
Date: June 5, 2008 at 08:47:14 Pacific
Reply:

Perfect, this is exactly what I needed.

Thanks!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Daily Batch file to create new fold

Batch File to Create a Shortcut www.computing.net/answers/programming/batch-file-to-create-a-shortcut/13374.html

Batch file to append created date www.computing.net/answers/programming/batch-file-to-append-created-date/14993.html

Batch file to create ini file www.computing.net/answers/programming/batch-file-to-create-ini-file/17654.html