gitignore files with extension in folder - wildcard

I'm trying to make git ignore all files with extension .ex but only if they are in a subfolder with the name subf. In man gitignore I read the following:
Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:
ยท A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or
directory "bar" anywhere that is directly under directory "foo".
However, if I put my **/subf/*.ex into .gitignore (in repository base directory) my files with .ex extension are not ignored! I read in this thread that I should add my exclusion rule to the file .git/info/exclude. This seems to work for me but I'm not happy with it since this is not how I understood .gitignore. Can somebody help me understand why putting **/subf/*.ex does not work in .gitignore. Thank you!

why not as simple as,
subf/*.ex
Or if you are expecting subf at any level,
**/subf/*.ex
It is working for me

Related

Avoid rendering of specific .md files from blogdown::serve_site()

I have a file located at
content/post/data_for_posts/my_file.md
I have it there because it's quite easy to do htmltools::includeMarkdown("data_for_posts/my_file.md") and recycle this file in different posts.
My problem is that when I serve_site() this creates a public/post/data_for_posts/index.html, which means, it gets posted to my website (as a January 1 of 0001). I guess I could change the date to year 10000, but I would rather handle it the way I handle the .Rmd and other files, as suggested here
I have tried to modify my config.toml but have not managed to solve the issue.
ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$", "content/post/data_for_posts/my_file.md"]
Here are a couple techniques that I use to do this:
Rename data_for_posts/my_file.md so it uses a file extension that hugo does not interpret as a known markup language, for example change .md to .markd or mdn.[*]
Rename data_for_posts/my_file.md so it includes a string that you will never use in a real content file, for example data_for_posts-UNPUBLISHED/my_file.md. Then add that string (UNPUBLISHED or whatever) to your config ignoreFiles list.[**]
[*] In the content/ directory, a file with one of the following file extensions will be interpreted by hugo as containing a known markup language: .ad, .adoc, .asciidoc, .htm, .html, .markdown, .md, .mdown, .mmark, .pdc, .pandoc, .org, or .rst (this is an excerpt of something I wrote).
[**] The strings listed in ignoreFiles seem to be case sensitive so I like to use all-upper-case characters in my ignored file names (because I never use upper-case chars in real content file names). Also note that there is no need to specify the path and my experience is that path delimiters (/ or \) cause problems.

How to change to the next above directory

I really would like to know how to change directory to the next file, using 2 dots (/..).
I can go back to previous directory but how to do something like that to go to the next directory WITHOUT THE NAME OF THE FILE PLEASE!
I know it is possbile with the name of the folder but my answer is different, please let me know.
What O.S are you using? In linux ubuntu/Debian distributions (and probably in windows, not sure), you can enter the first child directory by simply typingcd */, this will change your current directory to the first child directory available in alphabetical order, example:
-/home
-alan
-desktop
-music
-alex
-documents
-pictures
-lisa
Assuming your in /home, if you write cd */ in the terminal you will be in /home/alan, because -alan is the first folder/directory available.

How do /** and /* differ in terms of directory navigation in Grunt?

This is quite an easy one for you guys, but I can't find a definitive/formal answer to this question.
Suppose we are in directory A. Then,
"A/* " probably means: Every file and folder directly inside A.
"A/** " then may mean: Every file and folder inside A, and every file and folder directly inside every child that is directly inside A. (Basically, an extension of /* operator that traverses one level deeper of the root folder? aka "/** " = "/* /* " )
My "directly inside" terminology might be wrong. May be its better to say "direct child" or something, but you get the idea.
Then, what does "A/**/* " mean? Is it equal to "A/* /* /* " ?
Although this seems basic, its quite confusing when I don't have a formal definition of the operators.
I'm currently using Javascript and trying to modify a Gruntfile. But I guess these operators may come up in any context.
This behavior is not intrinsic to JavaScript and is not related to any operators: as far as JavaScript is concerned, it is just a string.
The handling of such glob expansion is determined by the specific library/consumer. For gruntjs it is covered in Grunt Globbing Patterns:
It is often impractical to specify all source filepaths individually, so Grunt supports filename expansion (also know as globbing) via the built-in node-glob and minimatch libraries ..
* matches any number of characters, but not /
** matches any number of characters, including /, as long as it's the only thing in a path part
All most people need to know is that foo/*.js will match all files ending with .js in the foo/ subdirectory, but foo/**/*.js will match all files ending with .js in the foo/ subdirectory and all of its subdirectories.
As such (but refer to the specific documentation!), /**/ generally means "match any depth of directories" and /*/ or /* means "match a single directory or file part".
The gruntjs documentation is a bit vague on the specific mechanics of ** in the standard "/**/*.x" pattern, but referring to node-glob says:
If a "globstar" (**) is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches. It does not crawl symlinked directories.
[.. The double-star character] is supported in the manner of bsdglob and bash 4.3, where ** only has special significance if it is the only thing in a path part. That is, a/**/b will match a/x/y/b, but a/**b will not.
Using this knowledge we get the equivalency (when used as a path component), of A/**/f with A/f, A/*/f, A/*/*/f, etc for every number of intermediate directories.
If you see A/**/* that means to recursively search all the way down the tree of every folder under folder A. For more information look up basic linux style file commands.

.hgignore website refresh files

My ASP.NET website references refresh files that are being excluded because they reside in the ...\bin\ directory of projects.
What can I add to my .hgignore file to ensure just the ...\bin\*.refresh files are NOT excluded?
Note: I understand I could use hg add ...\bin\my.dll.refresh for each of the references and continue with my .hgignore, but I'd like to avoid needing to manually add specific files types as this is error prone and easy to forget.
# use glob syntax
syntax: glob
# Ignore Visual Studio 2008 files
src/**.obj
src/**.exe
src/**.pdb
src/**.user
src/**.aps
src/**.pch
src/**.vspscc
src/**_i.c
src/**_p.c
src/**.ncb
src/**.suo
src/**.tlb
src/**.tlh
src/**.bak
src/**.cache
src/**.ilk
src/**.log
src/**.lib
src/**.sbr
src/**.scc
src/***/[Bb]in <---- Problem child
src/***/[Dd]ebug*/
src/***/obj/*
src/***/[Rr]elease*/
src/*_ReSharper*/
src/*[Tt]est[Rr]esult*
src/*[Bb]uild[Ll]og.*
src/*.[Pp]ublish.xml
src/***/PrecompiledWeb/
For "all except some names" you must use:
regexp pattern
add negative lookahead in regexp "all files"(get "all except in this subset" as result)
syntax: regexp
bin/(?!.*\.refresh$).+
in any case, check and debug this expression, using filenames with pattern bin\*.*refresh* and hg status command

Server.MapPath does not like ~/ and ./

I am using the following code to try and find a file contained in another directory from my code file.
Set fi=fs.OpenTextFile(Server.MapPath("~/counter/counter.txt"), 1)
I have also tried.
Set fi=fs.OpenTextFile(Server.MapPath("./root/folder1/counter/counter.txt"), 1)
In either case this should get me back to the counter.txt file. From what I understand ~/ moves up 1 directory and ./ moves up to the root directory.
Both times however I receive an error saying an invalid character has been used. When removing these I get a different error saying the path cannot be found (Which I would expect because it is not a valid path without moving up 1 directory).
What are the valid characters to do the following in VBscript:
move up a single directory?
move up to the root directory?
Thanks for the help
A few things:
The tilde character "~" is not valid here.
The single period character "." is for specifying the current directory/folder.
A set of period characters ".." is for specifying the parent directory/folder. For example, to refer to a file found in the parent of the current directory, you might use:
Server.MapPath("../counter.txt")
You can chain these to walk up more than a single parent path. To refer to a file found three directories above the current, you might use:
Server.MapPath("../../../counter.txt")
The documentation on MSDN for the MapPath function outlines this. Pay attention to the caution listed here about enabling parent paths if you want to be able to refer to relative paths above the current directory. If you get an error when trying to refer to a parent path, then you do not have parent paths enabled.

Resources