1
我已经创建了一个批处理文件,以将文件从ftp服务器复制到共享驱动器。我是写手稿的新手。当我运行.bat文件时,出现错误“找不到源文件夹”。如果我使用WINSCP,我可以进入目录并查看没有问题的文件。批处理文件不会复制文件
@Echo Off
ftp xxxxxx.org xxx
Set _UserName=xxxxxxxx
Set _Password=xxxxxxxx
set Source=ftp://ftp.xxxxxx.org/LOPE/mobiledoc
set Target=Z:\Scanned_Documents\LOPE
set FileList=Z:\Scanned_Documents\LOPE\FileList_LOPE.idx
if exist Z:\Scanned_Documents\LOPE\NUL echo "Folder already exists"
if not exist Z:\Scanned_Documents\LOPE\NUL echo "Folder does not exist"
if not exist "%Source%" echo Source folder "%Source%" not found & goto Exit
if not exist "%FileList%" echo File list "%FileList%" not found & goto Exit
if not exist "%Target%" md "%Target%"
for /F "delims=" %%a in ('type "%FileList%"') do copy "%Source%\%%a" "%Target%"
:Exit
echo.
echo press the Space Bar to close this window.
pause > nul
我改变了一些东西:我删除了回声。我在目标和文件列表声明中加入了引号。我也进入了文件列表文件,并将目录添加到fileList文件的文件名中。 – user2576682
我得到的错误说文件名称,目录名称或卷标标签语法不正确。 – user2576682