JR_13
JR_13

Reputation: 21

FTP Command Copy all text files then delete

Hi I have created a ftp cmd script that would copy the text files from local source to ftp folder destination. copying was succesful. but i want it to be more complex that after successfull copying, copy to another local folder (will serve as backup copy of text files, increment file name by 1 when exists) then it would delete the copied text files from the source.

My script goes like:

      @ftp -i -s:"%~f0"&GOTO:EOF
      open [172.16.xx.xx]
      oracle
      mypassword

      cd /ftp_destination/
      mput D:/local_source_folder

      quit

I know it is to much to ask and it is a bit complex, but helping a newbie would be a great help. Thanks for advance help.

Upvotes: 0

Views: 7678

Answers (1)

James K
James K

Reputation: 4055

@ftp -i -s:"%~f0"&GOTO:EOF
open [172.16.xx.xx]
oracle
mypassword

cd /ftp_destination/
mput D:/local_source_folder
!del /q D:/local_source_folder

quit

! is the shell command for FTP, and anything after it will be executed in a "dos" shell.

Alternitively, you can just do !ENTER and FTP will open a "dos" shell for you to type in. EXIT will return you to ftp. Like this:

@ftp -i -s:"%~f0"&GOTO:EOF
open [172.16.xx.xx]
oracle
mypassword

cd /ftp_destination/
mput D:/local_source_folder

!
del /q D:/local_source_folder
exit

quit

Upvotes: 2

Related Questions