Mike Minchinton
asked on
Need a script that will create its own directory to dump logs into
So I have this script below, and when it goes and retrieves logs, I need it to actually create its own directory in a folder in the C: drive. I have attached the script.
Anybody have any ideas on how I can make it create a directory each log dump?
SCRIPT:
Anybody have any ideas on how I can make it create a directory each log dump?
SCRIPT:
Echo OFF
Echo "Copy Flex Terminal Log files. Press Any Key If You Think You Can Handle It"
:NO
SET /p FN=Enter Flex Name:
Echo You Entered - %FN%
@ECHO OFF
:choice
set /P c=Is this correct Flex Name(Y/N)?
if /I "%c%" EQU "Y" goto :yes
if /I "%c%" EQU "N" goto :NO
goto :choice
Pause
:yes
SET /p DATE=Enter Date(mm-dd-yyyy):
Echo You Entered - %DATE%
:choice
set /P c=Is this correct date(Y/N)?
if /I "%c%" EQU "Y" goto :RUN
if /I "%c%" EQU "N" goto :YES
goto :choice
Pause
:RUN
net use \\%FN% PASSWORD /user:DOMAIN\USERNAME
xcopy "\\%FN%\c$\CGTDeviceManager\Logs" "C:\Users\USERNAME\Desktop\ZIPS" /D:%DATE%
xcopy "\\%FN%\c$\Program Files\Primeline Enterprise\Applications" "C:\Users\USERNAME\Desktop\ZIPS" /D:%DATE%
***xcopy "\\%FN%\c$\Users\ser-flexuser\AppData\Roaming\FlexTerminalClient\Local Store" "C:\Users\USERNAME\Desktop\ZIPS" /D:%DATE%***
xcopy "\\%FN%\c$\Documents and Settings\ser-flexuser\Application Data\FlexTerminalClient\Local Store" "C:\Users\USERNAME\Desktop\ZIPS" /D:%DATE%
Pause
ASKER
Actually, I need the logs to dump into a folder on the C: drive named Source-Code. Good idea on the DATE idea.
So just adjust this set to the folder you want:
set DestDir=C:\Users\USERNAME\ Desktop\ZI PS\XXXXXX
»bp
set DestDir=C:\Users\USERNAME\
»bp
ASKER
Is it possible to have it create a new directory each time, and name it the terminal ID?
Where would "Terminal ID" come from?
And would it be unique every time you ran the script?
»bp
And would it be unique every time you ran the script?
»bp
ASKER
the terminal ID is the first thing you enter when the script runs, and its unique in the way that the logs are always different
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Don't use DATE as a variable name, that is a system defined variable that you shouldn't re-use, I changed it to DT for my example. Below creates a dest folder of XXXXXX and then copies to that location.
Also, you know that for the current logged on user name you can reference the %USERNAME% variable, right?
Open in new window
»bp