Files keep getting overwritten
Hi guys,
This might seem like an arbitrary question, but I cannot seem to get it sorted.
The script needs to download all the files/folders in a directory from the server to a local directory. But there are too many files for the download to complete in a single session. The scripts runs from midnight to 6AM, another batch file runs at 6Am that forces the pc to shutdown.
Everything seems to work, and files resume download if there is a part file, however, my issue is that all the completed files gets overwritten again. So I can never get a complete local backup because the session's files gets downloaded again the next night. The same files are downloaded and overwritten every night.
The script looks like this:
I have tried "get", but the results are pretty much the same.
This is what I get from the log:
. 2016-05-19 11:13:25.811 Copying 292 files/directories to local directory "C:\Backup\folder1"
. 2016-05-19 11:13:25.811 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: Y (102400); CalcS: No; Mask: *.*
. 2016-05-19 11:13:25.811 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2016-05-19 11:13:25.811 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2016-05-19 11:13:25.811 File: '/home/Server1/folder1/027_l.wmv' [2016-05-11T10:02:38.000Z] [102534837]
< 2016-05-19 11:13:25.811 Script: Local 'C:\Backup\folder1' <= Remote '/home/Server1/folder1'
. 2016-05-19 11:13:25.811 Copying "/home/Server1/folder1/027_l.wmv" to local directory started.
. 2016-05-19 11:13:25.811 Binary transfer mode selected.
. 2016-05-19 11:13:25.812 Checking existence of partially transfered file.
. 2016-05-19 11:13:25.812 Opening remote file.
> 2016-05-19 11:13:25.812 Type: SSH_FXP_OPEN, Size: 55, Number: 2307
< 2016-05-19 11:13:25.868 Type: SSH_FXP_STATUS, Size: 24, Number: 2052
. 2016-05-19 11:13:25.868 Discarding reserved response
< 2016-05-19 11:13:26.057 Type: SSH_FXP_HANDLE, Size: 13, Number: 2307
> 2016-05-19 11:13:26.057 Type: SSH_FXP_FSTAT, Size: 13, Number: 2568
< 2016-05-19 11:13:26.252 Type: SSH_FXP_ATTRS, Size: 37, Number: 2568
. 2016-05-19 11:13:26.253 Confirming overwriting of file.
> 2016-05-19 11:13:26.254 Type: SSH_FXP_READ, Size: 25, Number: 2821
The file it is downloading already exists, it then starts a partial file, and it will resume from that partial in the next session until the completed file is overwritten. I am literally downloading the same files every night.
How can I set the script to not download existing files, I need to disable overwrite?
Any advice would be appreciated.
Thank you.
Edit to add:
I have now modified the script:
It seems to be working, but the script will run tonight from midnight so I'll have proper results tomorrow. The log results seems promising though.
This might seem like an arbitrary question, but I cannot seem to get it sorted.
The script needs to download all the files/folders in a directory from the server to a local directory. But there are too many files for the download to complete in a single session. The scripts runs from midnight to 6AM, another batch file runs at 6Am that forces the pc to shutdown.
Everything seems to work, and files resume download if there is a part file, however, my issue is that all the completed files gets overwritten again. So I can never get a complete local backup because the session's files gets downloaded again the next night. The same files are downloaded and overwritten every night.
The script looks like this:
open Server1 synchronize local -resumesupport=on "C:\Backup\folder1" "/home/Server1/folder1" exit
I have tried "get", but the results are pretty much the same.
This is what I get from the log:
. 2016-05-19 11:13:25.811 Copying 292 files/directories to local directory "C:\Backup\folder1"
. 2016-05-19 11:13:25.811 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: Y (102400); CalcS: No; Mask: *.*
. 2016-05-19 11:13:25.811 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2016-05-19 11:13:25.811 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2016-05-19 11:13:25.811 File: '/home/Server1/folder1/027_l.wmv' [2016-05-11T10:02:38.000Z] [102534837]
< 2016-05-19 11:13:25.811 Script: Local 'C:\Backup\folder1' <= Remote '/home/Server1/folder1'
. 2016-05-19 11:13:25.811 Copying "/home/Server1/folder1/027_l.wmv" to local directory started.
. 2016-05-19 11:13:25.811 Binary transfer mode selected.
. 2016-05-19 11:13:25.812 Checking existence of partially transfered file.
. 2016-05-19 11:13:25.812 Opening remote file.
> 2016-05-19 11:13:25.812 Type: SSH_FXP_OPEN, Size: 55, Number: 2307
< 2016-05-19 11:13:25.868 Type: SSH_FXP_STATUS, Size: 24, Number: 2052
. 2016-05-19 11:13:25.868 Discarding reserved response
< 2016-05-19 11:13:26.057 Type: SSH_FXP_HANDLE, Size: 13, Number: 2307
> 2016-05-19 11:13:26.057 Type: SSH_FXP_FSTAT, Size: 13, Number: 2568
< 2016-05-19 11:13:26.252 Type: SSH_FXP_ATTRS, Size: 37, Number: 2568
. 2016-05-19 11:13:26.253 Confirming overwriting of file.
> 2016-05-19 11:13:26.254 Type: SSH_FXP_READ, Size: 25, Number: 2821
The file it is downloading already exists, it then starts a partial file, and it will resume from that partial in the next session until the completed file is overwritten. I am literally downloading the same files every night.
How can I set the script to not download existing files, I need to disable overwrite?
Any advice would be appreciated.
Thank you.
Edit to add:
I have now modified the script:
open Server1 synchronize local -criteria=size "C:\Backup\folder1" "/home/Server1/folder1" exit
It seems to be working, but the script will run tonight from midnight so I'll have proper results tomorrow. The log results seems promising though.