copying files from server to local automatically using batch command -


i want copy particular logfile generated each day in 1 of server have access local daily automatically.

i prepared batch commands follows didn't work expected.

echo off

set logfiles=\\pwwas0015\ums_logs\server1\ums\service-*.log rem set var = c:\users\l068699\desktop\test\src echo %logfiles% copy %logfiles%  c:\users\l068699\desktop\test\  set yesterday = [datetime]::today.adddays(-1).tostring("yymmdd") echo %yesterday% pause 

the problem cana ble extract logs couldn't log service-2015-04-17.log. how can extract kind of log 1 day behind i.e. if today 2015-04-24 should previous day log file service-2015-04-23.log

try this:

pushd \\pwwas0015\ums_logs\server1\ums\ rem set var = c:\users\l068699\desktop\test\src ::echo service-*.log    /f "usebackq" %%a in (`"powershell (get-date).adddays(-1).tostring('yyyy-mm-dd')"`) set yesterday=%%a echo %yesterday% copy service-%yesterday%.log c:\users\l068699\desktop\test\ pause 

eventually you'll need net command map network drivre:

net use  \\pwwas0015\ums_logs /persistent:yes 

(put net use before pushd if not work)


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -