there will be two files in the shared directory for each serve that end with that text "050912.rpt.zip" so would your code copy both files?
2>nul sends the STDERR stream to nul so you do not see any harmless error messages on the screen.
1.) Can the code that you posted above can just totally replace mine? I don't need to use the "NET USE" way of doing it?
2.) Will this work on a Windows Server 2003 platform (the local and remote servers both being Win 2003).
4.) I need to do this for quite a few servers, but if I just copy paste this code in the batch file for each server, and edit it to contain the specific servers name, then it should be fine? (I know some kind of loop would be better, where the servernames are read in from another file but I just want to get this working first)
Adding a loop is easy - if the filenames change on every server then the text file will need a format like: \\server\share\file*name.txt
where * is a wildcard that matches your filespec. A FOR /F IN DO loop can then extract the filename.ext and the path.
5.) I think the account I will be using on the local box (where I will run the batch file) will be allowed to access the remote folder, however, just in case it isn't, can you specify a username and password with your way of doing things? If so, how would I do this? I think you can with "NET USE".
If you need to authenticate then you will need to use NET USE but the username and password will be in clear text in the batch file.
6.) Your way of doing it isn't really mapping a drive is it? because the share is just made to be the current directory, its not like another drive letter would appear on the local box and when clicked I would see the contents of the shared folder on he other server? if this is so then thats fine i think, just trying to understand it.
The way PUSHD works (that I have read) is that it maps the remote machine to a random free drive letter but you access the share as if it were a local folder.
Note that specifying the root as I did here may not work:
if exist \*050912.rpt.zip copy \*050912.rpt.zip "c:\files"
If the files are in the share folder then this will probably work instead.
if exist *050912.rpt.zip copy *050912.rpt.zip "c:\files"