Questions tagged [glob]

globs, more properly called [shell] patterns, and also known as wildcard expressions, are instances of a pattern-matching language used in many, esp. POSIX-like shells, to match filenames and strings: e.g., `*.c` is a glob for C source files and matches any file whose suffix (extension) is `.c`.

-1
votes
2answers
37 views

How do I get terminal in OSX recognise Regex as filenames?

In OS X terminal I have the following: for filename in ^.* 2\.jpeg$; do printf "$filename\n"; done; which I want to match filenames in the current folder ending in the string " 2.jpeg" but it's not ...
0
votes
1answer
24 views

How do I find all files that have a certain extension in Go, regardless of depth?

I have a directory structure that looks like this: /root /folder_1 file_name_1.md /folder_2 file_name_2.md /folder_3 file_name_3.md /folder_4 /sub_folder_1 file_name_4_1....
-1
votes
3answers
44 views

Can anybody explain the meaning of glob.glob() function in python?

I try to understand it by reading the documentation, but I still don't understand the difference between recursive=True|False and why do I need to write '*' or '**' in path name.
0
votes
1answer
24 views

Glob Pattern Matching String in either folder or file name

I need to match the word "cache" in either a folder or filename, and it also has to end in .test.js Example: /Users/doge/lib/cache/index.js // should not match /Users/doge/lib/cache/index....
0
votes
1answer
14 views

How to correctly get gulp.src globs from a variable?

Given the following Gulp setup const { src, dest } = require('gulp'); var zip = require('gulp-zip'); var pkgDist ='packages/'; function pkg(done) { src(['./**', '!node_modules/**', '!vendor/**'...
1
vote
1answer
21 views

Reindex from duplicate axis error while using glob.glob

When I try to run this code: import pandas as pd import glob files = [pd.read_excel(p, skipfooter=1) for p in glob.glob("path/*.xlsx")] df = files[0].append([files[i] for i in range(1,len(files))]) ...
0
votes
2answers
20 views

Natural Order needed for directory list

I am new to PHP and I need assistance making this bit work. I am trying to have the directory folders listed in a PHP page. So far it is working but the list of folders appears in "Standard" order. I ...
0
votes
1answer
46 views

how to add file path in to python script

I have got a script that delves into a given directory recursively, digs out all files that have a specific file name and puts the contents of all the ones it finds into a single file. The script ...
0
votes
1answer
26 views

Conditional Characters in Shell Globbing - Bash/Zsh

I'm trying to get a case statement to match one of four inputs in a Bash/Zsh shell: v -v version --version You can see where I'm going, right? I'm looking for this in the below case statement: ...
0
votes
2answers
48 views

Bash script - make all files in Directory hidden

I'm using the following script to make all files in a directory hidden by adding a dot "." at the beginning. GLOBIGNORE=".:.." for file in *; do mv -n "$file" ".$file"; done How can I exclude ...
1
vote
3answers
33 views

package.json and Eslint glob extension

My package.json is below. How do I update it so that eslint runs on: src and test directories for .js and .jsx files only? Right now the * wild card is including .json which I don't want. package....
-1
votes
3answers
44 views

How to add the filename to the last line read in of every file?

I have a set of files that are read in line by line. I would like have the last line of every file to have the name of the file next to it. This is the code that accomplishes the reading in the file ...
0
votes
1answer
18 views

Match all files, except ones with specific extensions

How can I fix ./src/js/**/!(*.spec.js|*.test.js), so it doesn't return directories? I've tried it like this ./src/js/**/*.!(spec.js|test.js), but it matches all files except the directories, the same ...
0
votes
4answers
43 views

How to walk through subfolders individually?

Actually I have a folder (data in below picture) which contains 2 subfolders and each subfolder includes some .png files. I need to have loop through each subfolder and do some coding on each image ...
0
votes
0answers
28 views

Why does glob fail when I call my function twice in Php

My glob() code written following: $site1 = glob("../htdocs/site1-*.txt"); $random_site1 = $site1[array_rand($site1)]; $site1_shuffle = file("$random_site1"); $data[site1] = implode("\r", array_slice(...
1
vote
1answer
53 views

How do I tell Babel CLI to ignore any path with “__” in it?

"@babel/cli": "^7.2.3", Seems really simple. https://babeljs.io/docs/en/babel-cli#ignore-files babel src --out-dir lib --ignore "src/**/*.spec.js","src/**/*.test.js" So I set it up like so: ...
0
votes
0answers
13 views

Error when using of glob to open various files in a folder

I have a simple Question, I'm using the following Code to open multiple files in Python but it doesn't work, it just gives me one error. Error: "SyntaxError: (unicode error) 'unicodeescape' codec ...
0
votes
1answer
26 views

How to copy multiple SVG files into a templated react component. NodeJs?

Struggling to wrap my head around how I might achieve this issue. I have roughly 500 SVG icons that I'd like to copy it's contents into a templated react component then save that .js file out as ...
0
votes
2answers
36 views

Set a variable to a filename using glob

I have a directory that contains another directory named ABC_<version number> I'd like to set my path to whatever ABC_<version number> happens to be (in a modulefile) How do I use glob ...
0
votes
1answer
27 views

Alert and stop script if duplicate filename found

I am trying to find any duplicate filename found in several sub-folders and stop the script and prompt the user about the duplicate. Using this example filenames: Money_03012019_2019.csv ...
0
votes
1answer
23 views

What glob pattern to use for files inside a folder AND sub-folders?

I'm trying to run a npm task to lint against certain JS files. Given the following list files: /root.js // should be excluded /js-src/lib/test.js // should ...
1
vote
1answer
30 views

How to merge data frame into one csv file after using glob?

I have tried to work on several csv files using glob, for example: import glob import pandas as pd import numpy as np import csv # Read all csv files with same file name in the folder filenames = ...
0
votes
0answers
10 views

Redis glob pattern for integers only

I need to scan for keys of PCRE pattern /^item:[0-9]+$/gm but it seems impossible to do it with SCAN 0 item:[0-9]* Available keys: item:bwj37s2kb6i6h6yn0e296n1pm:subscriber:de_DE:ALL:token item:...
0
votes
1answer
20 views

Move files matching glob in for…done loop returns 'no such file or directory'

I'm moving files based on their extension. The following works as expected when there are files matching the glob; but when there are no matching files it returns 'mv: rename /Users/xxx/Downloads/...
-5
votes
3answers
53 views

Remove files in directory and ignore if empty-BASH

By using the command : rm /file_path/*.csv I can delete all csv files in the required folder.However if the directory is empty or there are no csv files I get the following error: No such file or ...
0
votes
0answers
23 views

Construct glob pattern based on date range in Python?

Is there any existing Python library function (or otherwise reusable code) to construct a glob pattern based on a date range, or any other series of paths with common prefixes? Here's the context: I ...
0
votes
0answers
47 views

C++/gcov/lcov - How to exclude all but one directory from coverage data

I am creating code coverage reports for my C++ projects using gcov/lcov, and I am trying to remove all files except the ones in a certain directory from the coverage report (i.e. I do not want ...
1
vote
2answers
31 views

Output file much larger than input files after cat + grep

I have 18 csv files, all between 1mb and 14mb. The sum of all files is 64mb. I want to create a new csv file that contains a subset of those files-- only the lines featuring the pattern "Hello" (or "...
2
votes
1answer
45 views

Adding command line argument to read all images for color palette creation

I have images in the same directory as the python file named like below. - cat.png - dog.png - turtle.png - flower.png Currently I can run a program one at a time like below os.system('picol.py ...
0
votes
3answers
24 views

How to fix pattern, that I use to get list of files in folder with standard library glob?

I have the following files: /tmp/test_glob/client.log.71.gz /tmp/test_glob/client.log.63.gz /tmp/test_glob/client.log.11 /tmp/test_glob/core_dump.log /tmp/test_glob/client.log.32 /tmp/test_glob/dm....
0
votes
1answer
23 views

Python Glob search for specific filenames at the middle

I have a folder with path /home/alperen/Desktop/test and with files: 000001asdd.png 000005_C.png 000010-asda.png 000002gfg.png 000006fkjfkj.png .. etc Here is my code portion to ...
1
vote
1answer
40 views

Is there any difference between these 2 glob patterns?

images/**/*.{png,svg} images/**/*.+(png|svg) When I test them they usually produce the same result. But just need to make sure they are exactly the same.
0
votes
1answer
28 views

PHP Rename file which have unrecognized charactor

I'm trying to rename a file, That file generated by unizp a zip file, but the file have a strange character Lieferungen und R�cklieferungen_RvP_2019_02_04.csv we can't have control over that ...
1
vote
2answers
30 views

Use one glob.glob instead of multiple glob.glob [duplicate]

I have a folder containing files in different types. I only need to deal with image files (jpg, png, jpeg, JPG, ...). For that, I use glob.glob to get only files with 'jpg', 'png', ... extensions. The ...
-2
votes
1answer
25 views

Match files in directory with glob and regex

I had a problem with glob in php. First I'm create thumbs dynamically and file named as "thumb_width_heigth_filename.ext" Then i had to delete all created thumbs with "filename.ext" its not ...
0
votes
1answer
18 views

How to list files with python with their alphanumeric value? [duplicate]

I have a directory with these .txt files: 1.txt 2.txt 3.txt ... 100.txt 138.txt ... 100.txt 1923.txt If I list the directory with python (usign glob or os.listdir()), it produces such result: ...
0
votes
1answer
35 views

How to use wild card inside of fs.existsSync or statSync or readFileSync

My spec below clicks on a download button and then verifies the download. The only problem in the program is that you need to know the name of the file in advance. Rather I want it to look for a ...
0
votes
1answer
27 views

Python: Replacing Text in all files of a nested folder

I am trying to replace a string of text in all json files in a directory. Directory has several nested directories, depth of directory structure is not know. Below is my code, which is not replacing ...
1
vote
0answers
20 views

How to auto-import all the controllers in Node Restify application

I have all my controllers in routes folders. So instead of require(UserController.js)(server) for each and every new file that I create how can I make glob function that actually works without ...
0
votes
2answers
52 views

Iterate flv files in a folder and convert them to mp4 format

If I have a folder which has many flv format files, and I want to iterate these flv files and convert them to mp4 format in Python and ffmpeg. I would like to keep the files' original names except ...
2
votes
1answer
40 views

Bash associative array not unset when nullglob is set

When I set nullglob in bash: shopt -s nullglob and then declare an associative array: declare -A arr=( [x]=y ) I cannot unset specific keys within the array: unset arr[x] echo ${#arr[@]} # still ...
0
votes
1answer
36 views

check directory existence so for loop keeps running

I was wondering how I can check if my path exists in a global for loop. I was thinking of embedding an if statement within my for looop but I realized that this doesn't work. I need a check before ...
0
votes
1answer
45 views

Using Glob to get filenames with partial name inside folder to a list

I have several files with the same format, but with different values. with the help of StackOverflow users I got the code running, but now I am trying to optimize it, and I need some help to do it. ...
2
votes
1answer
36 views

How to use reg expression as a variable

I'm using ksh and I have a directory full of .csv and .CSV files. I want to list all csv files, both capital and lowercase endings. So I type: ls *@(CSV|csv) and that lists all the files. But if I ...
0
votes
1answer
26 views

Python glob: sorting files of format [int]_[int] the same as windows name sort

I have files that are sorted by name in windows like the following: 1_0 1_1 1_2 1_3 1_4 1_5 1_6 1_7 1_8 1_9 1_10 1_11 2_0 2_1 Per above the first integer before the _ should be the first sort, ...
1
vote
1answer
66 views

Using glob patterns not for default Grunt keys

1. Summary I can't set grunt-clean-console plugin, that it works for all my .html files. 2. Details grunt-clean-console check browser console errors for .html files. I want to check browser ...
0
votes
1answer
51 views

Calling a bash command via python

I have a command in bash: fslstats /Users/Downloads/ALLSITES/3dROIMaker/network3*_GM.nii.gz -l 1.5 -u 2.5 -V | cut -d ' ' -f 1 output: 755 If I'm now in python trying to run the same command: ...
0
votes
0answers
19 views

Babel cli ignore exact name folders

I use babel-cli to transpile my JS files. Command: babel . --ignore node_modules, test -D -d dist Structure of project: node_modules test components - header - footer - some-test a.js b.js After ...
1
vote
0answers
122 views

Expecting Ant GLOB pattern, but saw 'C:\Program Files (x86)\Jenkins\workspace\abc.zip

I'm trying to upload my artifacts to S3 Bucket from my Windows Machine using s3 Plugin of Jenkins. Getting error Expecting Ant GLOB pattern, but saw 'C:\Program Files (x86)\Jenkins\workspace\CD ...
0
votes
3answers
55 views

How to find unique files after removing files that have values in a particular list in Python?

I have the following files in a folder: "ABC" "ABC 10" "ABC 22" "ABC 30" "ABC L1" "ABC L2" "ABC 10 L1" "ABC 10 L2" "ABC 22 L1" "ABC 22 L2" "ABC 30 L1" "ABC 30 L2" "PQR" "PQR 10" "PQR 22" "PQR 30" "...

http://mssss.yulina-kosm.ru