How use Put command for uploading only new files

Advertisement

Pepper
Guest

How use Put command for uploading only new files

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.)

Reply with quote

Advertisement

Pepper
Guest

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

Thanks!

Reply with quote

Advertisement

Pepper
Guest

martin 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:[m:782fe1861a]
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
[/m:782fe1861a]

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).)

Reply with quote

Pepper
Guest

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

can be situation where local file will be newer than remote, and it not be uploaded, because file mask switch present.

Reply with quote

martin
Site Admin
martin avatar

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%\"

Reply with quote

Advertisement

You can post new topics in this forum