looking for some solutions? You are welcome.

SOLVED: CMD/FTP to create folder using to today date & connect ftp download into created folder

loh:

I'm new to this cmd/FTP command. I would like to create a new folder at my local directory using today's date and connect to FTP to download the specific file to the newly created folder. If I manually type in command one by one at cmd, it has no issue. But when I use a batch file to run, my command stopped at FTP.

setlocal enableextensions
set name=%date:~-10,2%"-"%date:~7,2%"-"%date:~-4,4"_"job%
mkdir C:\%name%
cd C:\%name%
ftp
open 192.168.31.93
*user*
*password*
binary
cd *directory*
mget -i *.*

I did try to separate my command to two batches; 1. folder creation 2. FTP download but the file downloaded didn't go into the folder I created. the downloaded file went to C:\Document & Settings.

main batch file

@echo off
call rename.bat
ftp -i -s:ftp.txt

rename.bat

setlocal enableextensions
set name=%date:~-10,2%"-"%date:~7,2%"-"%date:~-4,4%"_job"
mkdir c:\%name%
cd c:\%name%

ftp.txt

open 192.168.31.93
*user*
*password*
binary
cd *directory*
mget *.*
close

Another method I try is using '!' when in FTP environment, then create a folder then exit back to FTP environment. This method again doesn't work with the batch file. Please help



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent