简体   繁体   中英

Move files in a list from one directory to another on FTP server

I have a directory on FTP server with 1000s of files. I would like to move 100 files from that directory to another directory on same FTP server. I have a list which contains the exact name of files that I want to move. How can this be achieved ?

Test this with some sample files: the filenames go in filelist.txt and folder1 and folder2 are the source and target folders.

@echo off
set "name=your_ftp_user-name"
set "password=your_ftp_password"
set "server=ftp_server_name"


set "ftpScript=%temp%\%~nx0.ftp.tmp"
(
    echo open %server%
    echo %name%
    echo %password%
    echo bin
    for /f "usebackq delims=" %%a in ("filelist.txt") do 
      echo rename "\folder1\%%a" "\folder2\%%a"
    )
    echo quit
) > "%ftpScript%"

ftp -i -s:"%ftpScript%"
del       "%ftpScript%"
pause

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM