There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
bios black screen blue screen blue screen of death boot computer connection crash css dell display driver drivers email error excel firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking nvidia outlook outlook 2003 outlook express password printer problem router slow software sound sprtcmd.exe startup trojan usb virus vista windows windows xp wireless
DOS/PDA/Other
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Batch File Custom Folder Name Creation


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
dzhax's Avatar
Junior Member with 2 posts.
 
Join Date: Jul 2008
Experience: Beginner
21-Jul-2008, 02:16 AM #1
Exclamation Batch File Custom Folder Name Creation
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

Code:
@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's Avatar
Distinguished Member with 4,854 posts.
 
Join Date: Apr 2007
Location: India
Experience: Advanced
21-Jul-2008, 09:44 AM #2
here's how you can create the folder
Code:
MD %DATE:~4,2%%DATE:~7,2%%DATE:~10,4%_BACKUP
dzhax's Avatar
Junior Member with 2 posts.
 
Join Date: Jul 2008
Experience: Beginner
21-Jul-2008, 01:09 PM #3
Where would i put that code in and how would i use it to put files into that folder just created?
devil_himself's Avatar
Distinguished Member with 4,854 posts.
 
Join Date: Apr 2007
Location: India
Experience: Advanced
21-Jul-2008, 09:46 PM #4
Code:
@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%"
Closed Thread

Tags
backup, batch, date&time, dos, problem

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:19 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.