# Rewriting a batch file from an ftp copy to a network file system copy



## dsmack (Jun 12, 2007)

Hello! I am not good at writing batch files. It's all so Greek to me, so I'm hoping someone can help. I have a batch file that was originally written to ftp files from one server to another. Now it's been decided that ftp is not the mode of transport desired. Instead it's preferred I use nfs. So here's the ftp portion of the batch file:

REM - FTP DATA FILES:
:FTP
REM Generate the FTP script.
ECHO user %USERID% %PASSWD%>%UNLOAD_DIR%\unload_wfm.ftp
ECHO cd stream1>>%UNLOAD_DIR%\unload_wfm.ftp 
ECHO lcd %UNLOAD_DIR%>>%UNLOAD_DIR%\unload_wfm.ftp
ECHO mput *_%HH_TIME%.dat>>%UNLOAD_DIR%\unload_wfm.ftp
ECHO quit>>%UNLOAD_DIR%\unload_wfm.ftp

REM FTP DATA FILES (input script: %UNLOAD_DIR%\unload_wfm.ftp)
ftp -i -n -s:%UNLOAD_DIR%\unload_wfm.ftp %IP%>> %LOG_DIR%\%REPORT_FILE%


How do I change it to a regular copy? Thanks in advance. If you need more information, let me know. I can post the whole batch file if necessary.



d


----------



## Squashman (Apr 4, 2003)

Are you mapping a Drive letter to the share?


----------



## dsmack (Jun 12, 2007)

No drive letter mapping.

The copy is across a Windows network, both servers are Windows-based. I was a little confused by the term NFS as I thought that was indicative of a UNIX server. I think we should forget about the NFS term and just look at this as a straight copy between servers. I wondered if this would work:

REM - COPY DATA FILES:
REM Generate the COPY script.
REM CALL %FTP_BIN_DIR%\wfm_ftpinfo.bat 
ECHO user xxx xxxxxxxx>%UNLOAD_DIR%\unload_wfm.ftp
ECHO cd stream1>>%UNLOAD_DIR%\unload_wfm.ftp 
ECHO copy %UNLOAD_DIR%>>%UNLOAD_DIR%\unload_wfm.ftp

REM COPY DATA FILES (input script: %UNLOAD_DIR%\unload_wfm.ftp)
xcopy %UNLOAD_DIR%\unload_wfm.ftp \\xxxxx\Progra~1\Axxxxt\exxxxf~1\WxxDxxx\Lxxxxx\Sxxxxx1 >> %LOG_DIR%\%REPORT_FILE%


The issue is I have to install it tomorrow and I'd like it to work on the first try. I don't want to have to do editing on the fly because I wouldn't know where to start.

Thanks.


----------



## ChuckE (Aug 30, 2004)

There is no reason you can't map a drive located on another computer.
Let's say you decide on a drive letter M

Then just:
XCOPY M:wherever\unload_wfm.ftp C:\wherever

I assume it is just one file you want to copy over. It is one line. Whatever the directory paths are, and I am not trying to guess your paths here.

Note: If any of the path or file names have spaces, you just enclose the entire path parameter in quotes, such as:
XCOPY "m:\one place\Tools\unload_wfm.ftp" "c:\Somewhere else\blah blah\xxx"
And, by the way, it doesn't hurt to always use quotes, always. It makes it easier to edit later, since you always have the quotes to edit inside of, regardless if spaces are there or not.


----------



## dsmack (Jun 12, 2007)

Actually, this project is with the federal government, and more specifically for the air force, so mapping a drive is not that easy! The basic batch file worked fine with xcopy and I think we have the destination drive problem straightened out. Just need final approval from the Secretary of Defense!  

Thanks again for the help.


----------

