Jump to content

How to create a folder named .ignore on Windows


Recommended Posts

Posted

Excluding Files & Folders says to create a folder called .ignore, but the way to do this on Windows is not immediately obvious.

If creating the folder within the File Explorer, you must enter the folder name as .ignore. (with the dot before and after). The trailing dot will be removed. Explorer will not let you create the folder otherwise.

From a Windows command prompt or PowerShell window, the normal method should just work: mkdir .ignore

I suggest updating the KB to add this info somehow.

 

  • Agree 1
GrimReaper
Posted
Quote

To exclude a folder from the library scan, place a file inside the folder named .ignore

Phrasing in the KB article might be somewhat ambiguous - you don't create a folder, you create a file named .ignore within folder you want excluded. 

Maybe some punctuations or rephrasing would make it more clear:

"To exclude a folder from the library scan, place a file (inside the folder) named .ignore" 

Or 

"To exclude a folder from the library scan, place a file named .ignore inside the folder." 

@sa2000

  • Agree 1
  • Thanks 2
Posted

I didn't read it the way OP did, but after seeing this post I could see how that would be possible.

I guess it should read something like "To exclude a folder from the library scan, place a file named ".ignore" within the folder you would like to be ignored"

Posted (edited)

btw - to create an empty file from the windows command prompt -

copy con .ignore

then press enter and CTRL Z

This will then write a zero byte empty file called .ignore

 

Edited by rbjtech
  • Like 1
Posted (edited)

Or, maybe, simpler:

The CMD way:

fsutil file createnew .ignore 0

The PowerShell way:

new-item .ignore

 

Edited by justinrh
  • Like 1
Posted (edited)

*sigh* I have to fix dozens of folders now. I thought the method of designating a folder to be ignored had changed and was no longer based on .ignore files, but rather on directories named .ignore.

However, according to the changelogs, ever since Emby Server 3.5.0, on non-Windows platforms, any directory beginning with a dot is automatically ignored. Why not just have Emby do that on Windows, too? (And mention it in the Knowledge Base, regardless.)

Edited by Fweep
Posted

Let us know how you get on. Thanks.

Posted

You want the gory details of how I cleaned up the .ignore folders? OK.

A folder named .ignore has the same effect as a file named .ignore: the directory containing the .ignore-named item is ignored. So putting my conversion scripts and other random stuff in a folder named .ignore was quite a mistake—yes, they got ignored, but so did the video content and other stuff Emby needed to see in the parent folder.

So, with PowerShell, in each directory named .ignore, I first created a file named .ignore:

Get-ChildItem -Recurse -Directory -Include ".ignore" | ForEach-Object {New-Item -Path (Join-Path $_.FullName ".ignore") -ItemType "file"}

I then renamed each .ignore directory to .hidden:

Get-ChildItem -Recurse -Directory -Include ".ignore" | ForEach-Object { Rename-Item $_ ".hidden" }

And that's that.

Anyway, how about this for the KB:

Quote

 

To exclude a folder from the library scan, place a file or folder named ".ignore" within the folder you would like to be ignored.

On Mac and Linux platforms, any folder whose name begins with a dot will also be ignored.

 

 

  • Thanks 1
  • 5 weeks later...
Posted

Open the folder you want to "ignore" in File Explorer.

(If you are hiding file extensions,  you'll need to un-hide them to do this. In Win10, go to the View tab, click on Options on the right of the menu bar, and select Change Folder and Search Options. In the Folder Options window, switch to the View tab, and UNcheck "Hide extensions for known file types." Click Apply.)

Right-click in the folder, and select New, then Text Document. You will be prompted to give it a name - it doesn't matter what name you give it as long as you'll know which file it is. It will save the file with a .txt extension.

Rename the file (something.txt) to ".ignore" - make sure you remove any file extension, such as ".txt". You will be prompted with a message "if you change the extension, the file might not work, blah blah blah, are you sure?" Click yes.

The folder this file is sitting in will now be ignored.

To repeat for other folders, you can easily Copy and Paste this ".ignore" file into those other directories rather than create new ones individually, but either method works.

  • Thanks 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...