| 1. |
Solve : ADD DATE TO FOLDER NAME? |
|
Answer» This probably sounds like a bit of an odd question but I am looking to add the date to a folder name with a batch file. The reason for this is so that I can have it set to a schedule to run every day. The over all TASK is to put the date onto a folder name and then the program recreates the previous folder and fills it and then the next day at the same time this script runs again and everyone is HAPPY. The problem I am having is when I use the SET %DATE% command and try add its results to the folder is tells me that the MON or TUE or what ever the day is not a valid function. Is there another way to write this? Any help would be great.
I'm not sure what that line is meant to do. LOSE it! To set a variable, you don't use percent signs. To read it you do. For example set food=eggs echo %food% Also if you want to read the value of %date%, you should not be trying to set it. Use quotes around any file, folder or path containing spaces. Quote
I was missing the "" . Stupid mistake. The entire script looks like so: REM Create sub directory CALLED \yymmdd_hhmmss REM where yymmdd_hhmmss is a date_time stamp like 030902_134200 set hh=%time:~0,2% REM Since there is no leading zero for times before 10 am, have to put in REM a zero when this is run before 10 am. if "%time:~0,1%"==" " set hh=0%hh:~1,1% set yymmdd_hhmmss=%date:~12,2%%date:~4,2%%date:~7,2%_%hh%%time:~3,2%%time:~6,2% MOVE "\\PCNAME\D$\TEST" "\\PCNAME\D$\TEST%yymmdd_hhmmss%" Thanks for the help Guys/Girls --I have alot of learning to do-- |
|