Need batch file help

trythis

Registered User.
Local time
Yesterday, 18:46
Joined
Jul 27, 2009
Messages
67
I have a file that is placed on server01 every night at 11 PM Every morning the file has to be moved so that the users can access it.

I would like to write a batch file that moves the file to a new locaton so that the users can get to it. I will setup a scheduled task so that I do not have to do this.

The file is imported into access after it is moved.

file name mtcdata.csv

location
\\server01\arthur\mtcdata.csv

would like it moved to
\\server03\data\user\mtcdata.csv

I am guessing I need to map drives copy the file then unmap the drives??

a net use command in the .bat file maybe??

a new file is created every night at 11PM

Thanks,
Tina
 
Off topic but here you go anyway.
Although a batch file cannot refer to relative paths directly from a unc location it can still refer to and work with full unc paths so you don't need to map those drives.

It is a good idea to log the output of the command.

Code:
echo %date% - %time% >> mtcdata.log
move [URL="file://\\server01\arthur\mtcdata.csv"]\\server01\arthur\mtcdata.csv[/URL]  [URL="file://server03/data/mtcdata.csv"]\\server03\data\mtcdata.csv[/URL] >> mtcdata.log
echo.

To allow relative paths to be used in the script, in the first line use:
pushd %~dp0
This maps the path of the batch file to an available drive letter.
End the batch by releasing the mapping:
popd
 

Users who are viewing this thread

Back
Top Bottom