1.

Solve : How to copy a file from one server to another every thursday!?

Answer»

I need some help on the ISSUE below and I would appreciate if somebody can help me.

File Name: CA&T DB - Field Copy.mdb (MS Access)

Source Folder Name: \\ecdfn5\appl\CA&T DB\

Destination Folder Names: \\edvfn1\appl\CA&T DB\
\\edwfn1\appl\CA&T DB\

Process:
Would like for the script to automatically updated on Thursday (7:00 PM).
Can I append a date to the file name and still have an automatic process...i will not do your work for you. but i am going to give some suggestions
1) to map a drive, see here
2) To copy files, check out copy /? on the command line.
3) To run on thursday or whenever, use the GUI task scheduler in control panel.
Thx for the reply.
I really don't want you to do my work, but I still need some tips because I don't understand one thing as described below:
I will need to map the two servers or just the source folder?
If the network drive changed I'll need to manually UPDATE the script or can just don't have it on the xcopy command?

@echo off

net use \\ecdfn5\appl\CA&T DB\

xcopy \\ecdfn5\appl\CA&T DB\Field Copy.mdb \\edvfn1\appl\CA&T DB\ /s
xcopy \\ecdfn5\appl\CA&T DB\Field Copy.mdb \\edwfn1\appl\CA&T DB\ /sIsn't supost to be like this?


@echo off

net use \\ecdfn5\appl\CA&T DB\

xcopy \\ecdfn5\appl\CA&T DB\Field Copy.mdb \\edvfn1\appl\CA&T DB\ /E
xcopy \\ecdfn5\appl\CA&T DB\Field Copy.mdb \\edwfn1\appl\CA&T DB\ /E

Pause


Just a thougtI've a problem copying the files, probably because my folder COULD have an invalid caracter, therefore I need help from somedoby.

My folder name is CA&T DB and I think that "&" doesn't allow me to do the copy because I receive an error message. Any advise on the code below?

@echo Off

:Map

net useS: \\edvfn1\shared\appl\CA&T DB\
if errorlevel 1 goto map

net useR: \\edwfn1\shared\appl\CA&T DB\
if errorlevel 1 goto map

net useQ: \\edwfn1\shared\appl\CA&T DB\
if errorlevel 1 goto map

:success
echo Remaping of S: successfully completed.
:success
echo Remaping of R: successfully completed.
:success
echo Remaping of Q: successfully completed.

:Copying

xcopy Q:\\ecdfn5\shared\appl\CA&T DB\Field Copy.mdb S:\\edvfn1\shared\appl\CA&T DB\ /E
xcopy Q:\\ecdfn5\shared\appl\CA&T DB\Field Copy.mdb R:\\edwfn1\shared\appl\CA&T DB\ /E
I don't really know whats going on but I made a few adjustments:

Code: [Select]@echo Off
cls

::Begin mapping drives, if error occurs inform and prompt to retry.

:Smap
net use S: "\\edvfn1\shared\appl\CA&T DB\"
if ERRORLEVEL==1 (
echo S: could not be mapped. Press a key to retry.
pause >NUL
goto :Smap
)
echo Remaping of S: successfully completed.

:Rmap
net use R: "\\edwfn1\shared\appl\CA&T DB\"
if ERRORLEVEL==1 (
echo R: could not be mapped. Press a key to retry.
pause >NUL
goto :Rmap
)
echo Remaping of R: successfully completed.

:Qmap
net use Q: "\\edwfn1\shared\appl\CA&T DB\"
if ERRORLEVEL==1 (
echo Q: could not be mapped. Press a key to retry.
pause >NUL
goto :Qmap
)
echo Remaping of Q: successfully completed.
echo.
echo All drives mapped successfully. Begin copy.

::Start copying files across. And check for error.

:copy

:1
xcopy "Q:\\ecdfn5\shared\appl\CA&T DB\Field Copy.mdb" "S:\\edvfn1\shared\appl\CA&T DB\" /E
if errorlevel==1 echo. && echo xcopy Returned errorlevel=1. Press key to retry. && Pause >NUL && goto 1

echo.

:2
xcopy "Q:\\ecdfn5\shared\appl\CA&T DB\Field Copy.mdb" "R:\\edwfn1\shared\appl\CA&T DB\" /E
if errorlevel==1 echo. && echo xcopy Returned errorlevel=1. Press key to retry. && Pause >NUL && goto 1

echo Did it work?
echo.
pause >NUL

Don't know how that will work but the "" fixed the error I was getting. Post back with any problems.

I'm not an expert but do you still need the machine name when a drive is mapped? Just a thought - I seriously have no clue with this sort of networking but just double checking!

EDIT: Took the %'s off the errorlevel, wasn't aware it didn't work with them? Thx, it's working without the drive letter.

However, I still have another problem because my Windows Schedule tasks doesn't work and therefore I cannot use it to program the batch file.

I'm trying to use a comand line inside my file to run it EVERY thursday 7 PM. Has Anybody an idea or a tip on how it can be done? I'd appreciate a help, thx.I created another file with command line described below and it seems to be working. However I want to know if there is another solution different than it, thx.

@echo Off
cls

schtasks /create /tn "Copy every Thursday" /tr "\\ecdfn5\shared\appl\CA&T DB\Copy.bat" /sc weekly /MO 1 /d THU


echo.I founddddddddd it!

But I'm not sure if it's working.... :s

This is my command line:

schtasks /create /tn "Copy every Thursday" /tr "\\ecdfn5\shared\appl\CA&T DB\Copy.bat" /sc weekly /mo 1 /d THU /st 19:00:00



Discussion

No Comment Found