Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

amp9020

Upload new files if remote destination is empty

Greetings.

I have a SFTP server where my clients send me files on a daily basis.

The current setup is:
My SFTP runs a bash script that takes each /home/$USER$/upload folder and archives any files in /home/$USER$/upload/* into the cloud. The bash script creates a $USER$/YYYY-MM-DD/ folder in the cloud and puts the files in there.

The bash script then clears the /upload folder after each run.
The run happens in 1AM as a cronjob.

This results in:
/$USER/2018-08-03/upload/OLD_FILES_001.LOG

/$USER/2018-08-03/upload/OLD_FILES_002.LOG
/$USER/2018-08-03/upload/OLD_FILES_003.LOG
/$USER/2018-08-03/upload/RECENT_FILES_001.LOG
/$USER/2018-08-03/upload/RECENT_FILES_002.LOG
/$USER/2018-08-03/upload/RECENT_FILES_003.LOG

etc etc.

Most clients are okay with this and know how to follow instructions.
However, one client is uploading syncing his whole folder using a WinSCP script.
Therefore, I'm getting his old files + new files.

This is adding up space as each folder contains old files + new files.

He only needs to send me newly created files.

I told him to send me his winscp script and I can glance at it.

Here is his script:
# **********************************************************************
# Batch Mode On
option batch on
# Confirm Off
option confirm off
# **********************************************************************
#
# ***********************************************************************
# Connects to Server
#
open MYCOMPANY
#
synchronize remote
#
# **********************************************************************
# Disconnect from Server
#
close
#
# Exit WinSCP
#
exit
# **********************************************************************

How can I make WinSCP aware to upload new files that were created in his local folder?
(Remember, my side (the SFTP server), clears his /upload folder every night.
We do not hold his old files in the /upload/ folder for security.

How can I modify his script so it's aware of what to send?

Thanks in advance,
-amp9020