I have a EFS will thousands of folders, I need a regex that can find a folder called "NewFile" and select all the xml files in it which is in any of directory listed from the root directory.
i.e.
selects:
C:\dir1\something\something2\NewFile\some.xml
C:\dir1\something\NewFile\some2.xml
C:\dir1\NewFile\some3.xml
ignores:
C:\dir1\something\something.xml
I did some research and found this question
Regex match folder and all subfolders
But it was matching the folder name at the same level
So you want to match pathnames that contain NewFile followed by an XML file:
/NewFile\\.*\.xml$/
Related
I am trying to get the name of all .xlsx file in multiple subfolders with a root directory. I am wanting to exclude one or more subdirectories.
I have tried
File/Directory
Wildcard (RegExp)
Exclude wildcard
Required
Include subfolders
\\peace\vol2\Temp\Test
.*.xlsx
.*\bkup
N
Y
.+bkup.+
I want all files in all of the subfolders except for any files in the \\peace\vol2\Temp\Test\bkup subdfolder. I am using the Get file name step and it is working fine for the wildcard but the exclude is not excluding the directory.
I know I am close but can someone help with right syntax?
I use TortoiseHg and I have folders structure, as below:
testSet1
test1
filesystem
input_1.obj
output_1.obj
etalon_1.obj
result_1.obj
test2
filesystem
input_1.obj
output_1.obj
etalon_1.obj
result_1.obj
......
errors.txt
......
result.xml
I need to ignore only .obj files located in directories "testSetN/testN", but not in directories "testSetN/testN/filesystem".
I use glob pattern "*/*/*.obj" in .hgignore, but it doesn't work. Mercurial just ignores all .obj files in all directories (including "filesystem" directory). But if I use, for example, "testSet1/*/*.obj", then everything works fine. How can I do what I need?
It's not necessary for me to use only glob syntax. I would be grateful for any way.
Looking at https://www.selenic.com/mercurial/hgignore.5.html#syntax
Neither glob nor regexp patterns are rooted. A glob-syntax pattern of the form *.c will match a file ending in .c in any directory, and a regexp pattern of the form .c$ will do the same. To root a regexp pattern, start it with ^.
According to this, the glob */*/*.obj will match .obj files inside the filesystem directory, because the glob is not rooted. So it matches those files by rooting the glob at testSetN/
If you have the prefix of testSet on all folders, you can use the glob testSet*/*/*.obj. This way, it will ignore .obj files in a subdirectory of a directory that begins with testSet. - it would also ignore a/testSetX/testY/Z.obj as well as testSetN/testN/N.obj
Mercurial will also let you manually add files that would otherwise be ignored according to .hgignore, so you could simply ignore all .obj files, or use your original glob of */*/*.obj and hg add the files you want to track.
Edit: adding regex as discussed in the comments.
If you prefer regex, or don't have a pattern to root the glob at, you need to use a regex. The regex ^[^/]*/[^/]*/[^/]*\.obj$ to match any .obj file at exactly two levels from the repository root. That is:
^ to anchor the match at the root of the repository
[^/]*/ to match any first-level directory. That is any sequence of characters that does not contain the directory separator /
[^/]*/ again, to match any second-level directory.
[^/]*\.obj$ to match any filenames that end with .obj
I've succeeded to exclude bower components and node modules from my search results by choosing the folder -> mark directory as -> excluded, but I couldn't do the the same for my concat file (a file with all code of the js files of my project).
How can I exclude this file from my search results?
Edit | Find | Find in Path supports scopes. You can create a new scope (Settings | Appearance & Behavior | Scopes) with the generated file excluded and use this scope for searching. Or, place your generated file(s) into a separate folder and exclude it like you did for bower_components and node_modules
Edit: since 2017.2 you can exclude files by pattern - see https://www.jetbrains.com/help/webstorm/2017.2/directories.html, Exclude files
You can exclude files and folders by name pattern. Just follow the steps here https://www.jetbrains.com/help/phpstorm/excluding-files-from-project.html#exclude-by-pattern
Man, use Preferences => Directories and thats it!
I am Using maven to create a war file
my folder <app> contains folder1 folder2 file1 ..
i want to get only file1
I have tried with the following..
<packagingExcludes>app/*/*.js</packagingExcludes>
any help here
The configuration is correct but the regex looks different.We use ** to indicate multiple directories and * to indicate an optional part of a file or directory name, as mentioned here. If I am not wrong, your regex looks like excluding all .js files in all folders of app, which is different from your requirement
I would like to use the .hgignore file of Mercurial to ignore all files with file extension .tex, except those .tex files in one particular directory and whatever subdirectory of this directory.
I presume syntax: regexp will be required for this.
A brief explanation of the particular regular expression used, would also be very welcome, so that we can all learn a bit here.
Let's say you want to exclude the directory named exclude. The following regex would then match all files that end in .tex unless exclude/ comes somewhere before that:
^(?!.*\bexclude/).*\.tex$