Computing.Net > Forums > Windows 2000 > Creating Folder in 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.

Creating Folder in Batch File???

Reply to Message Icon

Name: Chris Knight
Date: November 29, 2004 at 06:07:45 Pacific
OS: Windows 2000
CPU/Ram: 1.6ghz
Comment:

Hello,

i'm trying to right a batch file that will create a new folder based on the system date (mm-dd-yy or mm-dd-yyyy). i'd also like to copy data into this folder after its created. i cant get it to work, and i'm not even sure i'm approaching it from the right angle. here is how my file looks right now:

c:
cd test
mkdir %DATE%
move c:\test\DATA\*.* c:\test\%DATE%

the above is not working, and i've did some research on this site and cant really find what i'm looking for. has anyone ever did anything like this before? i'm pretty new to batch files in Windows 2000. thanks for any help or suggestions

Chris



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 29, 2004 at 06:36:48 Pacific
Reply:

Try the following

Set FDate=%Date:~-10,10%
Set Fdate=%FDate:/=-%
MD C:\test\%FDate%
Move C:\test\DATA\*.* C:\test\%FDate%

You have to process the returned %Date% as it is not directly suitable to be used as a folder/file name.
On Computing Net there is a lot of examples about your issue: try XP, Programming, DOS Forum.


0

Response Number 2
Name: ramesh_sang
Date: November 29, 2004 at 07:07:10 Pacific
Reply:

hi,

u just cut paste the following code, then it will really work out.

@echo off
cd c:\temp
set folder=%date:~10,4%%date:~7,2%%date:~4,2%
mkdir %folder%
move c:\temp c:\%folder%

bye
ramesh


S. Ramesh
chat: sramesh_sang@yahoo.com
mail :
rameshsa@infotech.stph.net


0

Response Number 3
Name: Chris Knight
Date: November 30, 2004 at 05:09:34 Pacific
Reply:

Ramesh,

thank you very much for the reply. that works very well. it creates a folder, 20043011 for todays instance. one more quick question, if i change line 3 to look like this:

set folder=%date:~10,4%%date:~4,2%%date:~7,2%

instead of this:

set folder=%date:~10,4%%date:~7,2%%date:~4,2%

will todays folder now look like 20041130?

Chris


0

Response Number 4
Name: Chris Knight
Date: November 30, 2004 at 05:13:20 Pacific
Reply:

Ramesh,

thanks for the reply, i just tried my question in the above post and it works great! thanks again!!

Chris


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 Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: Creating Folder in Batch File???

Creating folders with batch files www.computing.net/answers/windows-2000/creating-folders-with-batch-files/61661.html

Batch file for converting a jpg www.computing.net/answers/windows-2000/batch-file-for-converting-a-jpg-/64270.html

Windows 2000 Batch File www.computing.net/answers/windows-2000/windows-2000-batch-file/53782.html