Skip to content

Ignore Files & Directories

Legacy File Extension Ignoring

TagStudio versions prior to v9.5.4 use a different, more limited method to exclude or include file extensions from your library and subsequent searches. Opening a pre-exiting library in v9.5.4 or later will non-destructively convert this to the newer, more extensive .ts_ignore format.

If you're still running an older version of TagStudio in the meantime, you can access the legacy system by going to "Edit -> Manage File Extensions" in the menubar.

TagStudio offers the ability to ignore specific files and directories via a .ts_ignore file located inside your library's .TagStudio folder. This file is designed to use very similar glob-style pattern matching as the .gitignore file used by Gitâ„¢1. It can be edited within TagStudio or opened to edit with an external program by going to the "Edit -> Ignore Files" option in the menubar.

This file is only referenced when scanning directories for new files to add to your library, and does not apply to files that have already been added to your library.

Tip

If you just want some specific examples of how to achieve common tasks with the ignore patterns (e.g. ignoring a single file type, ignoring a specific folder) then jump to the "Use Cases" section!

My Library/.TagStudio/.ts_ignore
# TagStudio .ts_ignore file.

# Code
__pycache__
.pytest_cache
.venv
.vs

# Projects
Minecraft/**/Metadata
Minecraft/Website
!Minecraft/Website/*.png
!Minecraft/Website/*.css

# Documents
*.doc
*.docx
*.ppt
*.pptx
*.xls
*.xlsx

Pattern Format

This section sourced and adapted from Git's1 .gitignore documentation.

Internal Processes

When scanning your library directories, the .ts_ignore file is read by either the wcmatch library or ripgrep in glob mode depending if you have the later installed on your system and it's detected by TagStudio. Ripgrep is the preferred method for scanning directories due to its improved performance and identical pattern matching to .gitignore. This mixture of tools may lead to slight inconsistencies if not using ripgrep.


Comments ( # )

A # symbol at the start of a line indicates that this line is a comment, and match no items. Blank lines are used to enhance readability and also match no items.

  • Can be escaped by putting a backslash ("\") in front of the # symbol.
# This is a comment! I can say whatever I want on this line.
file_that_is_being_matched.txt

# file_that_is_NOT_being_matched.png
file_that_is_being_matched.png
# TagStudio .ts_ignore file.

# Minecraft Stuff
Minecraft/**/Metadata
Minecraft/Website
!Minecraft/Website/*.png
!Minecraft/Website/*.css

# Microsoft Office
*.doc
*.docx
*.ppt
*.pptx
*.xls
*.xlsx
# To ensure a file named '#hashtag.jpg' is ignored:
\#hashtag.jpg

Directories ( / )

The forward slash "/" is used as the directory separator. Separators may occur at the beginning, middle or end of the .ts_ignore search pattern.

  • If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .TagStudio library folder itself. Otherwise the pattern may also match at any level below the .TagStudio folder level.

  • If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories.

# Matches "frotz" and "a/frotz" if they are directories.
frotz/
# Matches "doc/frotz" but not "a/doc/frotz".
doc/frotz/

Negation ( ! )

A ! prefix before a pattern negates the pattern, allowing any files matched matched by previous patterns to be un-matched.

  • Any matching file excluded by a previous pattern will become included again.
  • It is not possible to re-include a file if a parent directory of that file is excluded.
# All .jpg files will be ignored, except any located in the 'Photos' folder.
*.jpg
Photos/!*.jpg
# To ensure a file named '!wowee.jpg' is ignored:
\!wowee.jpg

Wildcards

Single Asterisks ( * )

An asterisk "*" matches anything except a slash.

# Matches all .png files in the "Images" folder.
Images/*.png

# Matches all .png files in all folders
*.png
# Matches any files or folders directly in "Images/" but not deeper levels.
#   Matches file "Images/mario.jpg"
#   Matches folder "Images/Mario"
#   Does not match file "Images/Mario/cat.jpg"
Images/*

Question Marks ( ? )

The character "?" matches any one character except "/".

# Matches any .png file starting with "IMG_" and ending in any four characters.
#   Matches "IMG_0001.png"
#   Matches "Photos/IMG_1234.png"
#   Does not match "IMG_1.png"
IMG_????.png

# Same as above, except matches any file extension instead of only .png
IMG_????.*
# Matches all files in any direct subfolder of "Photos" beginning in "20".
#   Matches "Photos/2000"
#   Matches "Photos/2024"
#   Matches "Photos/2099"
#   Does not match "Photos/1995"
Photos/20??/

Double Asterisks ( ** )

Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:

  • A leading "**" followed by a slash means matches in all directories.
  • A trailing "/**" matches everything inside.
  • A slash followed by two consecutive asterisks then a slash ("/**/") matches zero or more directories.
  • Other consecutive asterisks are considered regular asterisks and will match according to the previous rules.
# Both match file or directory "foo" anywhere
**/foo
foo

# Matches file or directory "bar" anywhere that is directly under directory "foo"
**/foo/bar
# Matches all files inside directory "abc" with infinite depth.
abc/**
# Matches "a/b", "a/x/b", "a/x/y/b" and so on.
a/**/b

Square Brackets ( [a-Z] )

Character sets and ranges are specific and powerful forms of wildcards that use characters inside of brackets ([]) to leverage very specific matching. The range notation, e.g. [a-zA-Z], can be used to match one of the characters in a range.

Tip

For more in-depth examples and explanations on how to use ranges, please reference the glob man page.

# Matches all files that start with "IMG_" and end in a single numeric character.
    # Matches "IMG_0.jpg", "IMG_7.png"
    # Does not match "IMG_10.jpg", "IMG_A.jpg"
IMG_[0-9]

# Matches all files that start with "IMG_" and end in a single alphabetic character
IMG_[a-z]
# Matches all files that start with "IMG_" and in any character in the set.
    # Matches "draft_a.docx", "draft_b.docx", "draft_c.docx"
    # Does not match "draft_d.docx"
draft_[abc]

# Matches all files that start with "IMG_" and end in a single alphabetic character
IMG_[a-z]

Use Cases

Ignoring Files by Extension

*.jpg
*
!*.jpg
./Photos/Worst Vacation/*.jpg
Music/Artwork Art/*.jpg

Ensuring Complete Extension Matches

For some filetypes, it may be nessisary to specify different casing and alternative spellings in order to match with all possible variations of an extension in your library.

Ignore (Most) Possible JPEG File Extensions
# The JPEG Cinematic Universe
*.jpg
*.jpeg
*.jfif
*.jpeg_large
*.JPG
*.JPEG
*.JFIF
*.JPEG_LARGE

Ignoring a Folder

# Matches any folder called "Cache" no matter where it is in your library.
cache/
# "Downloads" must be a folder on the same level as your ".TagStudio" folder.
#   Does not match with folders name "Downloads" elsewhere in your library
#   Does not match with a file called "Downloads"
/Downloads/
Photos/Worst Vacation/*.jpg
/Music/Artwork Art/*.jpg

  1. The term "Git" is a licensed trademark of "The Git Project", a member of the Software Freedom Conservancy. Git is released under the GNU General Public License version 2.0, an open source license. TagStudio is not associated with the Git Project, only including systems based on some therein.