Exclude certain file on Synchronize

Advertisement

joeahn
Guest

Exclude certain file on Synchronize

Hi,

Is there a way to exclude certain file when using Synchronize. If yes, could you give me a simple example code.

Thanks

Reply with quote

Advertisement

3K
Donor
Joined:
Posts:
34
Location:
Geneva

Synchronize files from specified date stamp?

Hi,

Is there a command to synchronize files starting from a specified date stamp? I would like to exclude files if their file's modified dates is before 1 Jan 2012.

Thanks.

Reply with quote

3K
Donor

In Tracker Bug 672, the status is Fixed in: 5.0.6. Does it mean version 5.0.6? Is it possible to download this version and know the command to exclude by time stamp? Currently, in the download page, we can see 5.0.5 but not 5.0.6.

Thanks.

Reply with quote

Advertisement

3K
Donor

In Tracker Bug 672, the status is Fixed in: 5.0.6. Does it mean version 5.0.6? Is it possible to download this version and know the command to exclude by date stamp (not time stamp as written in my previous post)? Currently, in the download page, we can see 5.0.5 but not 5.0.6.

Thanks.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
34,147
Location:
Prague, Czechia

I have emailed you a link to development version of WinSCP.

Syntax file mask with timestamp is:
<2012-02-01 00:00:00

Reply with quote

3K
Donor
Joined:
Posts:
34
Location:
Geneva

martin wrote:

I have emailed you a link to development version of WinSCP.

Syntax file mask with timestamp is:
<2012-02-01 00:00:00

Thanks a lot Martin, got the development version. In my script below, if I wanted to synchronize documents posted >= 2012-01-01 00:00:00, where will I insert the command:

open ftp://username:password@ftpserver.itu.int
synchronize local C:\TEST\docs /docs
close

Thanks again.

Regards

Reply with quote

Advertisement

3K
Donor
Joined:
Posts:
34
Location:
Geneva

martin wrote:

synchronize -filemask="<2012-02-01 00:00:00" local C:\TEST\docs /docs

Thanks Martin, that command works well, :D excellent.

Reply with quote

3K
Donor
Joined:
Posts:
34
Location:
Geneva

Hi Martin,

I was trying to synchronize with filemask and include Word documents (*.doc*) only using the commands below, but it seems, it doesn't work:

option include=*.doc*
synchronize -filemask="<2012-02-01 00:00:00" local C:\TEST\docs /docs

synchronize -filemask="<2012-02-01 00:00:00" local C:\TEST\docs /docs -include="*.doc*"

Could you kindly help me.
Thank you.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
34,147
Location:
Prague, Czechia

The -filemask swich overrides include option (which is obsolete anyway with 5.0.6).
Also there's no -include switch.

Correct syntax is:
synchronize -filemask="*.doc*<2012-02-01 00:00:00" local C:\TEST\docs /docs

Reply with quote

Advertisement

3K
Donor
Joined:
Posts:
34
Location:
Geneva

Thanks again, it works. That command filters Word doc with timestamp.

Another question, if I would like to include multiple filters, for example, Word (*.doc*) and Powerpoint (*.ppt*) files, what will be the command. I tried the command below, but it doesn't work.

synchronize -filemask="*.doc* *.ppt* <2012-02-01 00:00:00" local C:\TEST\docs /docs

Also, is it possible to have the new switch commands available for synchronize?

Many thanks for your excellent support.

Regards.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
34,147
Location:
Prague, Czechia

synchronize -filemask="*.doc*<2012-02-01; *.ppt*<2012-02-01" local C:\TEST\docs /docs

Also, is it possible to have the new switch commands available for synchronize?
Do not understand.

Reply with quote

3K
Donor
Joined:
Posts:
34
Location:
Geneva

Thank again :D , that command worked perfectly.

For my other question, is there a web page describing the new Synchronize command, with examples? If there is none yet, it's ok.

Regards.

Reply with quote

Advertisement

3K
Donor
Joined:
Posts:
34
Location:
Geneva

Parameter -filemask in .NET Assembly?

What will be the equivalent command of filemask in .NET Assembly as shown below?

synchronize -filemask="*.doc*<2012-02-01; *.ppt*<2012-02-01" local C:\TEST\docs /docs

.NET example:
synchronizationResult =
    session.SynchronizeDirectories(
        SynchronizationMode.Local, @"C:\TEST\docs", "/docs", false);


Thank you.

Reply with quote

GerMurphy
Guest

Ignore Certain Folders During a sync

I was wondering how to sync all folders on my desktop computer with those hosted on a remote server.
I have established connection with the server and been able to synchronize with it but there are folders to which I do not have the required permissions and I wish to exclude them from the sync.

This is not a problem if doing it manually but I wish to automate the process.

Reply with quote

Shikhil
Guest

Rename existing file when syncing - File version with winscp

Dear Team, need to know how to script winscp to rename the newly copied file to the destination, if it already exists there. Kind of file versioning.

Reply with quote

Advertisement

Torsten
Donor
Joined:
Posts:
9
Location:
Copenhagen

OPTION EXCLUDE with strange results for hidden UNIX files

I tried to use the "exclude" option to exclude a file
.protftpd.fifo
because the file can for some reason not be transferred. The file is located on a NAS with Linux, where I have shared a folder via SMB. My script is otherwise working fine.
I use this syntax:
option exclude .proftpd.fifo
But the result is different from my expectation:
...
include         |.proftpd.fifo
Comparing...
Local '\\backup\backup3\Old' => Remote '/Old'
Synchronizing...
Local '\\backup\backup3' => Remote '/'
\...\.proftpd.fifo        |            0 B |    0,0 KB/s | binary |   0%
...
(and then my script fails because of this file).
I have tried to "quote" the file name in quotation marks, no help.
What can I do to exclude the file?
Torsten

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
34,147
Location:
Prague, Czechia

Re: OPTION EXCLUDE with strange results for hidden UNIX files

Torsten wrote:

I tried to use the "exclude" option to exclude a file
.protftpd.fifo
because the file can for some reason not be transferred. The file is located on a NAS with Linux, where I have shared a folder via SMB. My script is otherwise working fine.
...
Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Torsten
Donor
Joined:
Posts:
9
Location:
Copenhagen

Re: OPTION EXCLUDE with strange results for hidden UNIX files

Hej Martin
Here we go.
First, as it looked on the command prompt. Note that it does not exclude the file ".protftpd.fifo", the rest is secondary. Note further that the source folder "\\backup\backup3\" is on an FTP server as well, but since WinSCP cannot copy directly from one FTP server to another, I had to share the folder on the source FTP server as an SMB share.
D:\Klinikdokumenter\Klinik - EDB\Klinik Backup\NAS Synchronization>"C:\Users\Administrator\AppData\Local\Programs\WinSCP\WinSCP.com" /loglevel=2 /loglevel=2 /log=logfi
le.log /xmllog=logfile.xml /script=glostrup-test2.txt
batch on
reconnecttime 60
include |.proftpd.fifo
Connecting to fjernskrivebord.tg150.dk:8021 ...
Connected
Starting the session...
Session started.
Active session: [1] **********@fjernskrivebord.tg150.dk
Comparing...
Local '\\backup\backup3' => Remote '/Test'
Synchronizing...
Local '\\backup\backup3' => Remote '/Test'
\...\.proftpd.fifo | 0 B | 0,0 KB/s | binary | 0%
Lost connection.
Timeout detected. (control connection)
Could not retrieve file information
Can't get attributes of file '/Test/.proftpd.fifo'.
(A)bort, (R)econnect (0 s): Reconnect
Connecting to fjernskrivebord.tg150.dk:8021 ...
Connected
Starting the session...
Session started.
Lost connection.
Timeout detected. (control connection)
Could not retrieve file information
Can't get attributes of file '/Test/.proftpd.fifo'.
(A)bort, (R)econnect (4 s): Abort
Lost connection.
Timeout detected. (control connection)
Could not retrieve file information
Can't get attributes of file '/Test/.proftpd.fifo'.
Copying files to remote side failed.
Session 'backupuser@fjernskrivebord.tg150.dk' closed.
No session.
Exit code: 1
Max roundtrip: 5569
D:\Klinikdokumenter\Klinik - EDB\Klinik Backup\NAS Synchronization>

Second, the content of the script file here:
option batch on
option reconnecttime 60
option exclude .proftpd.fifo
open -passive=on ftp://**********:***************@fjernskrivebord.tg150.dk:8021
synchronize -delete -criteria=either -transfer=binary -resumesupport=on remote "\\backup\backup3\" "/Test/"
exit

Third, I attach the log file as requested. The interesting line is this one:
. 2020-05-14 01:08:29.219 Local file '\\backup\backup3\.proftpd.fifo' [2020-05-11T16:57:20.000Z] [0] included to synchronization

Fourth, I would like to mention that I found a workaround. As I noticed that the mysterious file is located in the FTP root folder, I simply moved my entire lot into a subfolder so that the hidden file is no longer in the way.

Good luck.

/Torsten
Description: XML log file
Description: Log file with log level 2

Reply with quote

martin
Site Admin
martin avatar

Re: OPTION EXCLUDE with strange results for hidden UNIX files

Thanks for all the details. Isn't the .proftpd.fifo actually a folder, not a file?

Reply with quote

Advertisement

Torsten
Donor
Joined:
Posts:
9
Location:
Copenhagen

Re: OPTION EXCLUDE with strange results for hidden UNIX files

You are right, it is a folder.
Do you mean to say I should use another exclude filter then? Which one?

martin wrote:

Thanks for all the details. Isn't the .proftpd.fifo actually a folder, not a file?
/T

Reply with quote

Guest

Re: OPTION EXCLUDE with strange results for hidden UNIX files

Hej Martin,

it works like a charm.
So, given the following folder structure:
 Directory of \\backup\backup3
11-05-2020  18:53    <DIR>          .
11-05-2020  12:13    <DIR>          ..
11-05-2020  18:57    <DIR>          .proftpd.fifo
14-05-2020  20:35    <DIR>          Daily Backups
11-05-2020  12:18    <DIR>          Old Backups
11-05-2020  12:37    <DIR>          Test

I have two possibilities now:
synchronize  -filemask=|.proftpd.fifo/;"Old Backups/";"Test/"  remote  "\\backup\backup3\"   "/Daily Backups/" 
 
vs.
synchronize  remote   "\\backup\backup3\Daily Backups\"   "/Daily Backups/"
Where the former uses the file mask to exclude the unwanted ones, and the latter uses the source folder to only include the wanted.

Thank you!
/Torsten

Reply with quote

Advertisement

You can post new topics in this forum