Topic "Can I Move Files on FTP Host Server?"

Author Message


Hi All,

I've started setting up the automation of picking up files off of the FTP Host, and all of this is working as intended thus far.

The next step I need to achieve, and I'm not sure if its possible or not is to move the source file on the FTP Host to another directory on that FTP host once it has been copied without changing the name of the file on the host server.

The script I am currently using, does not seem to work. Some guidance please?

@echo off /script=dailyimport.txt

if %ERRORLEVEL% neq 0 goto error
echo Download succeeded, moving local files
move *.csv /downloads/MySQL/downloaded
exit /b 0
echo Upload failed, keeping local files
exit /b 1

My dailyimport.txt looks like this:

# Connect
open ftp:details
# Change remote directory
cd /downloads/MySQL
# Force binary mode transfer
option transfer binary
# Download file to the local directory
get filename001_*.csv "E:\Data\DailyImports\newfilename001.csv"
get filename002_*.csv "E:\Data\DailyImports\newfilename002.csv"
get filename003_*.csv "E:\Data\DailyImports\newfilename003.csv"

mv *.csv cd /downloads/MySQL/downloads/*.csv
# Disconnect
# Exit WinSCP
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
Use mv *.csv /downloads/MySQL/downloaded/* in the WinSCP script file (dailyimport.txt).

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License