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

Author Message
SalientAnimal

Guest


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?

Code:
@echo off
winscp.com /script=dailyimport.txt

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


My dailyimport.txt looks like this:

Code:

# 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
close
# Exit WinSCP
exit

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

You can post new topics in this forum






Search Site

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License