Lee Yogel
asked on
batch files Error
i created a batch file that goes and pulls data from a folder that is created on a daily basis in the following format
eg D20110429 within that folder are .pdfs that are copied to a local server.
The command line reads as follows:
cd Sierra Expidite\G148bc\web\report s\archive\ D%date1%
I receive the following error:
It should drill down the the current date folder.folder presence was verified
The system cannot find the specified path.
The Syntex of the command is incorrect
I
Also within the same batch file I want to copy the above pdf data to a directory that has the days of the week
eg Monday batch files are created as .pdf in folder name D20110429 at location A
batch needs to pull all pdf info from D20110429 and copy it ti a corrisponding day of the week folder
I have attached the batch file for review
eg D20110429 within that folder are .pdfs that are copied to a local server.
The command line reads as follows:
cd Sierra Expidite\G148bc\web\report
I receive the following error:
It should drill down the the current date folder.folder presence was verified
The system cannot find the specified path.
The Syntex of the command is incorrect
I
Also within the same batch file I want to copy the above pdf data to a directory that has the days of the week
eg Monday batch files are created as .pdf in folder name D20110429 at location A
batch needs to pull all pdf info from D20110429 and copy it ti a corrisponding day of the week folder
I have attached the batch file for review
rem ***Get current date into %date% variable without separators***
REM *** This determines the system date for Windows NT***
rem @echo off
for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
set DayOfWeek=%%i
set Month=%%j
set Day=%%k
set Year=%%l
set Date=%%l-%%j-%%k-%%i
set Date1=%%l%%j%%k
set Date2=%%j
)
net use P: /d
Echo ****Copying reports for Bridesburg****
net use P: \\192.168.2.70\c$
p:
cd \Sierra Xpedite\G148BC\Web\Reports\Archive\D%date1%\
pause
copy *.pdf F:\Shared Files\Daily\Earth Star\Shared Directory\Shared\dailyin\*-Bridesburg.pdf
net use P: /d
pause
Echo ****Copying reports for Bridesburg Completed****
net use P: /d
Echo ****Copying reports for Pulaski****
net use P: \\192.168.4.70\c$
P:
cd \Sierra Xpedite\G148BC\Web\Reports\Archive\D%date1%\
copy *.* F:\Shared Files\Daily\Earth Star\Shared Directory\Shared\dailyin\*-Pulaski.pdf
f:
net use P: /d
Echo ****Copying reports for Pulaski Completed****
pause
Echo ****Copying reports for Torresdale****
net use P: \\192.168.5.70\c$
P:
cd \Sierra Xpedite\G148BC\Web\Reports\Archive\D%date1%\
copy *.pdf F:\Shared Files\Daily\Earth Star\Shared Directory\Shared\dailyin\*-Torresdale.pdf
f:
net use P: /d
Echo ****Copying reports for Torresdale Completed****
echo ****IT08****
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad I could help
cd .\Sierra Xpedite\G148BC\Web\Reports
Better to put brackert to paths and filenames. In case you have spaces:
copy *.* "F:\Shared Files\Daily\Earth Star\Shared Directory\Shared\dailyin\*
You can't "SET DATE" to something
Also, your date parsing is wrong. Use this instead and replace %date% to %TheDate% in your script.
Open in new window