Computing.Net > Forums > Windows XP > Auto folder Batch file

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.

Auto folder Batch file

Reply to Message Icon

Name: leonardbd
Date: December 12, 2005 at 21:25:33 Pacific
OS: Win XP
CPU/Ram: 256
Comment:

Can any one help me to Automatically create Folder/Files according to the current system date using in Batch file?

Leonard B.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: December 12, 2005 at 22:38:44 Pacific
Reply:

First you need to take a look at your DATE layout.

Mine is:

Tue 13-12-2005

So if I do:

echo %date:~10,4%%date:~7,2%%date:~4,2%

I get:

20051213

Given that, I can:

md %date:~10,4%%date:~7,2%%date:~4,2%

to make a directory or, to make a file:

type nul > %date:~10,4%%date:~7,2%%date:~4,2%.txt


If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: leonardbd
Date: December 12, 2005 at 23:34:03 Pacific
Reply:

I tried in command prompt
C:\Documents and Settings\wb261923>echo %date:~10,4%%date:~7,2%%date:~4,2%
After this I got the following result..

003/

My date setting is mm,dd,yy
Why I am not getting your result like: 20051213

please help.

Leonard B.


0

Response Number 3
Name: Mechanix2Go
Date: December 12, 2005 at 23:46:05 Pacific
Reply:

You need to post your EXACT date layout.

Do this:

echo %DATE%


If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: leonardbd
Date: December 13, 2005 at 19:50:54 Pacific
Reply:

Would you please type the complete command and its output of this process? So that I can understand whats wrong with mine.
LEo

Leonard B.


0

Response Number 5
Name: Mechanix2Go
Date: December 13, 2005 at 20:57:56 Pacific
Reply:

Sure, but I need the DATE layout.

Do this:

echo %DATE%

and post result.


If at first you don't succeed, you're about average.

M2


0

Related Posts

See More



Response Number 6
Name: leonardbd
Date: December 13, 2005 at 22:19:08 Pacific
Reply:

Here is the Result

C:\Documents and Settings\wb261923>echo %date%
12/14/2005

Leonard B.


0

Response Number 7
Name: Mechanix2Go
Date: December 13, 2005 at 22:45:59 Pacific
Reply:

Hi Leonard,

I think this is the syntax you need:

echo %date:~6,4%%date:~0,2%%date:~3,2%

Let us know.


If at first you don't succeed, you're about average.

M2


0

Response Number 8
Name: leonardbd
Date: December 14, 2005 at 19:16:23 Pacific
Reply:

YESS!!!!!!!!!!!! It Works!!!! Thank you verymuch! U save my Day. How the syntex working here acctually? Maybe I can make change for need.

Leonard

Leonard B.


0

Response Number 9
Name: Mechanix2Go
Date: December 15, 2005 at 06:25:22 Pacific
Reply:

Hi Leonard,

the syntax gets the specified parts of a string.

echo %string:~x,y%

means to skip the first x characters and use the next y chars.

Does that make sense?


If at first you don't succeed, you're about average.

M2


0

Response Number 10
Name: leonardbd
Date: December 16, 2005 at 20:39:23 Pacific
Reply:

Hello,
I got the picture. Here is an example of date pattern I decided to use for my auto folder naming.

C:\Documents and Settings\wb261923>echo %date:~6,4%_%date:~0,2%_%date:~3,2%

2005_12_17

That's it!! Cool huh?
Thanks to you BOSS.

Leo

Leonard B.


0

Response Number 11
Name: Mechanix2Go
Date: December 16, 2005 at 21:21:10 Pacific
Reply:

Hi leo,

Good work


If at first you don't succeed, you're about average.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Auto folder Batch file

Auto-run batch file to system error messages www.computing.net/answers/windows-xp/autorun-batch-file-to-system-error-messages/175672.html

How do I Auto run batch file Every 60 minute www.computing.net/answers/windows-xp/how-do-i-auto-run-batch-file-every-60-minute/179011.html

Auto Login Batch File www.computing.net/answers/windows-xp/auto-login-batch-file/180539.html