How do I ignore folders and files

Hello guys,

I’m new here and I would like to ask your help to configure the synchronization ignoring certain folders. I’m running on Windows PC.

I’m sharing the following directory for syncrhonization:

C:\Users\UserName\

Within this directory, I want the following folders to be synchronized:

  • A:\Users\UserName\Desktop
  • A:\Users\UserName\Documents
  • A:\Users\UserName\Downloads
  • A:\Users\UserName\Music
  • A:\Users\UserName\Pictures
  • A:\Users\UserName\Videos

And I need that the following folders to be ignored:

  • A:\Users\UserName\3D Objects
  • A:\Users\UserName\Contacts
  • A:\Users\UserName\DriveFS
  • A:\Users\UserName\Favorites
  • A:\Users\UserName\Links
  • A:\Users\UserName\OneDrive
  • A:\Users\UserName\Saved Games
  • A:\Users\UserName\Searches

I read the instructions in article “Ignoring Files” but it is not clear for me how to do that. Does anybody would have an step-by-step or something like?

Hi guys,

I used the web interface to do the following:

Folders > Edit > Ignore Paterns tab, then I included the following information:

3D Objects
Contacts
DriveFS
Favorites
Links
OneDrive
Saved Games
Searches
.url
Default.rdp
Duplicate Cleaner log.txt
desktop.ini

The last four lines are files I want to ignore as well as the folders.

I saw the interface created a hidden file .stignore in the folder I shared.

So, is it how it works? Is my understanding right?

Sounds right. They will however ignore any directory named like that, even Documents/Contacts etc.

You might want to “root” them by adding a / prefix. So /Contacts instead of just Contacts. You might also want to make them case insensitive as explained in the docs.

Case insensitive by default on Windows I think.

Thank you for your repply AudriusButkevicius. So it should looks like:

/3D Objects
/Contacts
/DriveFS
/Favorites
/Links
/OneDrive
/Saved Games
/Searches
*.url
Default.rdp
Duplicate Cleaner log.txt
desktop.ini

And how does it work if I want to root but also set as case sensitive? I didn’t see any combination of commands in the help guide.

You are right calmh, the help says:

On Mac OS and Windows, patterns are always case-insensitive.

1 Like

This looks like a typical %USERPROFILE% folder in Windows, so I need to ask this question. Are you absolutely sure that these are the only files and folders that you want to ignore?

I am asking, because in that folder there are many more hidden and system files and folders, which may not be visible in the Explorer by default. However, Syncthing does not care whether a folder is “hidden” or “system” in Windows, and will go through all of them.

Do you really want to sync all of these?

If yes, then please ignore this post, but if that is not the case, and the only folders that you really want to synchronise are:

then I would suggest adding to your .stignore the following:

!/Desktop
!/Documents
!/Downloads
!/Music
!/Pictures
!/Videos
*

This way, Syncthing will sync only the specifically listed folders, and ignore everything else.

1 Like

Hi tomasz86, thank you for your question and your thinking is right.

In case I want to synchronize %USERPROFILE% folder I should have a bigger list of folders to ignore.

However, both my desktop and laptop have two hard drivers, being C: for OS (Windows 10 Pro in this case) and A: for data. The first thing I did after format both computers was move the folders of my interest to the secondary HDD A:, so I just moved the folders I mentioned above.

But again, your thinking is right, if I had just one hard drive I would need to make a bigger list of folders to ignore and pay attention if any program creates another one.

tomasz86, reading your repply again, I noticed the following:

Could you explain it better? When I use “!” + “/” Syncthing will understand it should only synchronize these folders? and is the “*” necessary in the end?

  • ! means do not ignore (i.e. these files and folders will be synced).

  • * means ignore everything (except the lines marked with !).

  • / (or \ in Windows) matches only the top folder under A:\Users\UserName, i.e. A:\Users\UserName\Desktop, but not A:\Users\UserName\abc\Desktop.

Also, the order matters, so * needs to placed after everything marked with !.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.