Topic "How use Put command for uploading only new files"

Author Message
Pepper

Guest


Hi.

I wrote script which must upload some files to my FTP.
In which I use PUT command.

How I can say to PUT command don't upload the already existing files in remote directory?

Before WinSCP I excellent used ncftpput tool, but it don't understand russian utf-8 file names. And if I try upload same files of local and remote directory ncftpput say: "remote file appears to be the same as the local file, upload is not necessary." - is what I need.

But WinSCP in this case still upload files - do unnecessary work.

(Sorry for my English.)
Advertisements
Pepper

Guest


In other words, I need a command (or combination command/switches) like:
"synchronize remote"
but for files (not for folders)

Thanks!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
You can do synchronize remote -filemask=filename to restrict synchronization to a single file.
https://winscp.net/eng/docs/scriptcommand_synchronize

There's also this outstanding request:
https://winscp.net/tracker/show_bug.cgi?id=666
Pepper

Guest


prikryl wrote:
You can do synchronize remote -filemask=filename to restrict synchronization to a single file.
https://winscp.net/eng/docs/scriptcommand_synchronize

There's also this outstanding request:
https://winscp.net/tracker/show_bug.cgi?id=666


Thank you, for reply and outstanding request.
synchronize remote -filemask=filename - I can't use.
Awaiting we can solve this problem in the next release WinSCP?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Pepper wrote:
synchronize remote -filemask=filename - I can't use.

Why?
_________________
Martin Prikryl
Pepper

Guest


prikryl wrote:
Pepper wrote:
synchronize remote -filemask=filename - I can't use.

Why?

I use WinSCP in script mode.
I run it from batch: WinSCP.exe /console /script="C:\wscpcmd.txt" /parameter %prm%

wscpcmd.txt:
open ftp://... -passive=on -timeout=10 -rawsettings Utf=2
option batch on
option confirm off
option reconnecttime 20
synchronize remote "C:\to_upload\%1%" /Public
close
exit


where is %prm% can be single file or folder, and I don't know exists this file/folder at FTP or not.
If I upload folder to FTP - I don't know which files in this folder already exists, because I can't use -filemask.

(In this example sсript will be problem if %prm% contain single file name (not folder).)
Pepper

Guest


Or, if I use put for uploading single files with switch -filemask for example:
put -resume -transfer=automatic -filemask="|my_file.zip" "my_file.zip"


can be situation where local file will be newer than remote, and it not be uploaded, because file mask switch present.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
If the parameter can be folder or file, you just need to make the include mask accept both files and folders:

synchronize remote "C:\to_upload\" /Public -filemask="%1%;%1%\"
_________________
Martin Prikryl
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