Delete only directories in maven - regex

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

Related

Regex for all folders under one folder with a specific name

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$/

Git - Ignore directories based on their contents

Using .gitignore, is there a way to ignore a directory if it contains a certain file (or directory)?
This would be something like look-ahead assertions, though my use case is a little different: I want to ignore Mercurial repos in my project, to keep from accidentally committing them as part of the project. That is, I want to ignore all directories containing .hg, not just .hg itself.
I can work around this using the answer from this question, adding each directory name to .gitignore, but I'd like to make it more general if I can.
There is no way to do it beside adding all of them to your .gitignore file.
What you can do it to write a scipt which append all the desired paths to your .gitignore.
The content of .gitignore is alist of paths so git can be configured based upon content.
Each line in a gitignore file specifies a pattern

Exclude file from search but not from the project list in WebStorm

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!

How to hgignore all subfolders but not the file in a folder?

I am looking to use nuget without committing the packages. I want to ignore in mercurial all packages subfolder that are located in the /packages/ folder, but I do not want to exclude the repositories.config file located in the /packages/ folder.
How should I write the exclusion regex to do that?
Can't you just do this:
hg add packages/repositories.config
And then have this in your .hgignore file
syntax: glob
packages
?
syntax: regexp
packages/(?!repositories.config).*
[source]
For ignore all jpg files with subdirectories in folder images:
^images/.*\.jpg$

.hgignore syntax for ignoring only files, not directories?

I have a problem which I can't seem to understand. I'm using TortoiseHg (version 0.7.5) on Windows but on Linux I have the same problem. Here it is:
My .hgignore file:
syntax: regexp
^[^\\/]+$
What I'm trying to achieve is to add to the ignore list the files which are in the root of the hg repository.
For example if I have like this:
.hg
+mydir1
+mydir2
-myfile1
-myfile2
-anotherfile1
-anotherfile2
.hgignore
I want myfile1(2) and anotherfile1(2) to be ignored (names are only for the purpose of this example - they don't have a simple rule that can be put in the hgignore file easily)
Is there something I'm missing because I'm pretty sure that regexp is good (I even tested it)? Ideas?
Is there a simpler way to achieve this? [to add to the ignore list files that are in the root of the mercurial repository]
I relayed this question in #mercurial on irc.freenode.net and the response was that you cannot distinguish between files and directories — the directory is matched without the slash that you're searching for in your regexp.
However, if you can assume that your directories will never contain a full-stop ., but your files will, then something like this seems to work:
^[^/]*\..*$
I tested it in a repository like this:
% hg status -ui
? a.txt
? bbb
? foo/x.txt
? foo/yyy
Adding the .hgignore file gives:
% hg status -ui
? bbb
? foo/x.txt
? foo/yyy
I .hgignore
I a.txt
which indicates that the a.txt file is correctly ignored in your root directory, but x.txt in the foo subdirectory is not. You can also see that a file named just bbb in the root directory is not ignored. But maybe you can add such files yourself to the .hgignore file.
If you happen to have a directory like bar.baz in your root directory, then this directory and all files within will be ignored. I hope this helps a bit.
Here is a dirty trick:
Create an empty file ".hidden" in your directory, than add to .hgignore:
^mydir/(?!\.hidden).+$
This will ignore all files in the directory except ".hidden".