# Batch File Custom Folder Name Creation



## dzhax (Jul 21, 2008)

Hello,

I am making a batch file to automatically backup certain files when the batch is runned. I had no problem making the files backup. My problem is making the folder that they backup in start with the current date in mm/dd/yyyy format followed with _backup. so todays folder would be called 07/21/2008_backup. I tired doing this


```
@echo off
color 0F
cls
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET Today=%%B
SET LOCATION=%Today%_backup
goto bac
:bac
cls
if not exist %LOCATION%\characters mkdir %LOCATION%\characters
Echo :: Starting To Backup Important Files...
copy /V /Y /A characters .\%LOCATION%\characters
echo :: Backup Complete!
pause
cls
```
But it did not work  Any help would be great!

Thanks In Advance,
Dzhax


----------



## devil_himself (Apr 7, 2007)

here's how you can create the folder

```
MD %DATE:~4,2%%DATE:~7,2%%DATE:~10,4%_BACKUP
```


----------



## dzhax (Jul 21, 2008)

Where would i put that code in and how would i use it to put files into that folder just created?


----------



## devil_himself (Apr 7, 2007)

```
@echo on
set src=%DATE:~4,2%%DATE:~7,2%%DATE:~10,4%_BACKUP
if not exist "%src%" md "%src%"

copy /V /Y /A files "%src%"
```


----------

