Glob for exclude 'node_modules', 'package.json', 'package-lock.json' and include all other files and folders - expression

Could someone help me with glob string? I need to exclude 'node_modules', 'package.json', 'package-lock.json' and include all other files and folders.
Thank you!
Best regards,
Alex

Related

Copy files and rename - Gradle

I know there are already a couple of StackOverflow posts regarding copying and renaming for Gradle but sadly none seem to be applicable to my issue...
I'm trying to copy and rename files from multiple directories, here's my approach:
task copyReportsForDocs(type: Copy) {
from rootProject.files("path1",
"path2",
"path3",
"path4")
into genDir
rename '(.*)_$d_(.*)', '$1$2'
}
The files which should be renamed look something like this:
captured_0_foobar_request.adoc
captured_0_foobar_response.adoc
captured_1_fuubar_request.adoc
captured_1_fuubar_response.adoc
I just need the front portion to be deleted so it looks something like this:
foobar_request.adoc
foobar_response.adoc
fuubar_request.adoc
fuubar_response.adoc
Any help is appreciated, thanks!
This worked for me:
task copyReportsForDocs(type: Sync) {
from(rootProject.file("path")) {
include '**/*foo*'
rename 'captured_\\d+_(.+)', '$1'
}
}

Ruby - Pathname.glob - matching hidden and non hidden files

I am using Pathname.glob to match files.
Pathname.glob("**/*") matches only non-hidden files
Pathname.glob("**/.*") matches only hidden files
Is there any way to match both?
Your help would be appreciated!
Pathname.glob("**/*", File::FNM_DOTMATCH)
Source: http://www.ruby-doc.org/core-2.1.2/Dir.html#method-c-glob

Not Able to Exclude a Folder in WinMerge

I'm using WinMerge and want to exclude any folder, and associated sub-folders, called 'help'. For example, I have a folder called 'help' and want to exclude that folder and all it's sub-folders. I tried using the following filter:
name: Archibus Conv
desc: Archibus Conversion
def: include
d: \\\.svn$ ## Subversion working copy
d: \\_svn$ ## Subversion working copy ASP.NET Hack
d: \\\help$ ## Help system
d: \\^help ## Help system
But I am still picking up most, if not all, the 'help' subsystem files. Can someone point out what I am doing wrong?
Thanks in advance,
The problem had to do with my regular expression. The following did the trick:
D: \help\ ## help system

filtering out FileUtils.cp_r

FileUtils.cp_r does exactly what I need, but it's not able to filter out files by some pattern.
So, I would like to copy recursively a complex folder/files structure to another directory, but I'd like to only include files with txt extension. How would I do that?
FileUtils.cp_r Dir['**/*.txt'], target_dir

Dir globbing not recursing fully

files = Dir[File.join(path, '**', '*.jpg')].each do |s|
puts s
end
I have a bunch of subfolders within a directory and this snippet seems to go into some of the subdirectories, but skips most of them. How can I make it so that it recurses into all directories?
Also, should I be using Find instead? If so, could someone provide an example that does the same as above, namely finding .jpgs in all subdirectories?
EDIT -
Ok, so apparently when I do it with .JPG (capitalized) it finds all the files. Strange... How can I tell to find either of them?
This may help with different extensions:
files = Dir[File.join(path, '**', '*.{jpg,JPG}')].each do |s|
puts s
end
Obviously you forgot use glob method on Dir like:
Dir.glob(File.join('**','*.jpg'))

Resources