Hi! Today I want to talk with you about such feature of CloudCross as .include and .exclude files.
This feature was added to the program for customizing a list of files which will be synchronized with the cloud. This can be useful when you have many various files in the synced folder and on the cloud and you want to sync an only limited list of this.I show you how it works on an example of mine case of synchronizing.
I have a folder which contains files for periodically synchronize with a cloud (GoogleDrive in my case).
As you can see this folder contains a few files and few folders and two links to folders located in other places of a filesystem.
That is as looks my Google drive
As you realize, in the picture shows not all of the files. They are much more. But for an understanding of conception, this must be enough.
So, for example, I want to sync only a kp.kbd file. Then my .include file must be seen like this:
Result looks like this
This is very simple and not interested case. Let's try to complicate this example.
Let's I want to sync all files in all folders which have a .doc and .docx extension. Then .include file must contain something like this:
As a result, we get
Well. This is more interesting. In this case, we see what does when we sync folders which were early synced.
My cloud has a folder named FBReader® book network which contains fb2 files. And this folder doesn't sync with my local folder. If we change an .include file to
and start synchronization we get
Wow! It's strange. What happens?
I was expecting what I get all fb2 files from the cloud to a local folder. Thank goodness that I use
--dry-run option otherwise I'd have to restore deleted files from trash.
The cause of such unexpected behavior is that this folder contains only six files with fb2 extension. Well, I need be a more careful. Let's change .include list to
/FBReader® book network/*
and don't forget use
--prefer remote option.
And finally, we get desired result - entire folder with fb2 files was downloaded to the local side.
So, as you can see in all examples above we use wildcards. This is the default mode for working with .include and .exclude lists. This mode can be enabled by
--filter-type option with wildcard argument. The same result can be reached if you write wildcard at the first line of your .include or .exclude files. But as I said this mode is a default and will be used unless otherwise specified.
But we have and the second mode. This mode support working with Perl-style regular expressions.
This mode can be enabled by
--filter-type option with regexp argument or by putting this argument as simple string at the first line of .include or .exclude files.
Unlike the wildcard mode, regexp mode is a more powerful. Examples of using the regular expressions you can find easily on the Web.
Now, when we've discussed using include/exclude files mechanism, I want to say a few words about situations when you can use them.
By default, CloudCross uses exclude mode. That is, if your synchronized folder contains an .exclude file then CloudCross will be using it. If you set
--use-include option then CloudCross will look for an .include file in your directory. And if found it then this file will be used. The mode preferred to you can be determined based on your situation.
If you stay have questions about using include/exclude files with CloudCross you can ask about this in comments below.