Globbing means matching files by name patterns containing wildcards.

learn more… | top users | synonyms (2)

1
vote
1answer
27 views

Apply given rsync exclude patterns on given directory

I have a setup where I use rsync to mirror some source directory to a (remote) destination except for some files and locations defined witch rsync exclude patterns: # Useless files - thumbs.db - *.~ ...
3
votes
2answers
67 views

Loop in WildCard as Input of Script

I want to use my script on many files sometimes. I used this for the purpose: for etminput in $1 do #process done But this just gives the first input. How can I do the process on every ...
1
vote
3answers
43 views

bash/shell pathname expansion for mkdir, touch etc?

So doing something like this in bash and most other shells won't work to create multiple subdirectories or files within subdirectories... mkdir */test touch */hello.txt There are of course many ...
1
vote
2answers
36 views

Why asterisk in command result in for loop is expanding?

I want to write a script that will run git diff --name-status master..<BRANCH> but when I run this: for i in $(git branch | grep -v master); do echo $i; done I get echo one directory ...
2
votes
1answer
43 views

How to use " rm !(*keyword) in bash 4.1.2?

I got bash 4.1.2 on remote centos machine. When using my favorite rm !(*keyword) I got bash: !: event not found I tried to upgrade its bash, but seems the edition remains after upgrade. The ...
3
votes
2answers
30 views

Disable glob qualifiers in zsh

Is there a way to disable glob qualifiers with zsh? It seems like a useful feature, but it gets in the way of normal parentheses. I use ag to search files, and ag mymethod(param) causes zsh to ...
1
vote
3answers
58 views

Why is ls command slow to interrupt on NFS directory with lots of files?

I noticed in directories with lots of files on NFS if I do ls * then hit Ctrl-C it can take a while ( say 20 seconds ) before ls comes back. Why? Can ls command be fixed to be more responsive?
1
vote
1answer
35 views

Expand shell variable without globbing

I want to check whether an input string refers to a file name - not a wildcard string like *.txt. This doesn't work: if [ -f "$1" ]; Because $1 gets expanded to *.txt, which gets expanded to, say ...
0
votes
1answer
33 views

ls command - list files containg speccific string in file name and belong to specific type

I am new to linux. Is it possible for a ls command to return a list of files containing "PRO" in its file name and belong to pli file type. I have researched and identified that ls -c -lt *.PLI will ...
2
votes
2answers
67 views

Is a ? treated in a special way in parameter expansion?

I'm attempting to parse to output from git status --porcelain -b for use in my prompt but I'm coming across strange behaviour when performing parameter expansion. This snippet should demonstrate the ...
3
votes
4answers
257 views

Make many subdirectories at once

Suppose I have a directory /, and it contains many directories /mydir, /hisdir, /herdir, and each of those need to have a similar structure. For each directory in /, there needs to be a directory doc ...
2
votes
2answers
111 views

Bash copy all files that don't match the given extensions

When I import pictures from my camera in Shotwell, it also imports the video clips. This is somewhat annoying, as I would like to store my videos in another folder. I've tried to write a bash command ...
2
votes
2answers
32 views

Select a range of files after sorting them

One thing I notice slower for me if I switch from using a GUI file manager to CLI is: In a GUI file manager, I can quickly select a subset of files under a dir by, first sorting them according to ...
3
votes
2answers
70 views

Move every file that is not a directory

I have a directory that I am trying to clean out that contains both files and subdirectories. What I am trying to do is simple: move all the files into another directory, but leave all the ...
2
votes
3answers
105 views

Count files in a directory by extension

For the purpose of testing, I'd like count how many images files are inside a directory, separating each image file type by file extension (jpg="yes". This because later it will be useful for another ...
1
vote
1answer
31 views

processing multiple extensions

I have done a script to convert recursive .jpg files to another size: echo $re mkdir "$re"_tmp for a in *.jpg ; do convert "$a" -resize $re "$re""_tmp/${a%.*} ["$re"].jpg" ; done I'd like integrate ...
3
votes
2answers
131 views

Valgrind /usr/lib files are not regular Linux files

The problem that I encountered today (on an embedded device with Linux) is that some files (specifically, the Valgrind /usr/lib files) are behaving very strange and they are not copy-able with scp ...
2
votes
1answer
60 views

rsync specific directories

Below are the directories of my directory structure. I only want to run rsync on the content under the archive directory of any subdirectory and exclude everything else: ./ ap/ ap/aploader/ ...
4
votes
5answers
323 views

Bash pattern to match all files but directories

In bash, how do I specify a pattern that matches everything but subdirectories in current directory. Given that the pattern */ matches all the subdirectories, I tried (with extglob turned on): $ echo ...
3
votes
1answer
101 views

find files without extension

Let say I have: foo.txt bar baz.ooo If I use ls -1 !(*.*) then I'll get only bar on the output. Great, now I wish to have same results with find - some find -regex that will do the job. NOTE: ...
0
votes
3answers
64 views

find command: -or option doesn't work

I want to execute a command for an each file that matches a pattern. But the command that seems to be right, doesn't work for me, I have no idea why. $ find . -type f -name '*.c' -or -name '*.h' -or ...
2
votes
2answers
41 views

how to filteri by asterisk or similar expression by rsync in zsh

I have a lot of files named like: /var/log/foo/2014-07-06-01.log ... /var/log/foo/2014-07-20-04.log Everyday I have several log files and I want to download specified day's log files: $ rsync ...
1
vote
3answers
46 views

List files in a directory with a certain extension

I created a file called ~/usrlibs.txt, which contains the number of files that begin with lib and end .a found in the /usr/lib directory. I tried: ls -l /usr/lib/lib .a | wc -w > ~/usrlibs.txt ...
1
vote
2answers
45 views

Problems with basename in a loop

I am new at shell script programming and I'm trying to execute a software that reads a text and perform it's POS tagging. It requires an input and an output, as can be seen in the execute example: $ ...
-6
votes
2answers
90 views

Shell script to compile C files

I used to have a shell script that would compile all of the FILE.c files in a directory to FILE.out I lost it and am trying to remake it and have the following which I know is very similar but can't ...
1
vote
2answers
165 views

Aix grep wildcard not working

I have a file called message that has the line CSC/UT/USA/WBIMB/SAP/orders05:orders05/ORDERS05/NONE/ORDRSP/758 I am doing a grep (Platform is AIX 6.1) grep ...
3
votes
3answers
109 views

History of Bash globbing

Is there a historical reason why Bash "globbing" and regular expressions are not identical? For example, I believe that in Bash [1-2]* matches anything that starts with a 1 or a 2 followed by anything ...
3
votes
2answers
83 views

Error when calling mv with wildcards

#! /bin/bash error_text=$(tail -n +1 /path/dir/folder/exc/a/update/Abd/ER/* | \ grep 'Warning\|Loaded\|Event') echo $error_text nc 10.10.99.45 25 << EOF ehlo mail.abc.pvt mail from: ...
0
votes
3answers
49 views

find * looks for a file named “*” on Debian but not on RHEL

Where is the difference? Do these distributions handle something differently? Or does the configuration vary? What do I have to compare and adjust? I would prefer find * not to match the wildcard ...
1
vote
1answer
66 views

Globbing with * in Bash - Debian vs RHEL [closed]

Where is the difference? Do these distributions handle globbing differently? Platforms: Debian Wheezy 7, Red Hat Enterprise Linux 7. Bash is always used. In my example, cat prints every file in /etc ...
4
votes
4answers
193 views

What is the Linux command to display how many file names in the directory end in two digits

What is the Linux command to display how many file names in the directory end in two digits? Using ls with a command like this : ls -l | wc –l *[0-9][0-9]
5
votes
3answers
404 views

Linux command to return all files that start with TEMP but do not end with double digits

What is the Linux command to return all files that start with TEMP but do not end with double digits? I think it should look something like this: ls -l TEMP*[!0-9][!0-9] but the results of my ...
3
votes
5answers
130 views

Look if a folder has some files of certain extention

Lets say I have a file structure: $ cd /home/Desktop $ ls -d */ Abc/ Qwe/ Zxc/ Rty/ $ Now I want to iterate through every directory and look if they have any .pdf files. Could some one please ...
5
votes
4answers
371 views

Check if a folder has a certain type of file present

How could I check if a file has a file of extension .java? So far I have: for javaFile in *.java ; do { echo "The file $javaFile has : " >> ~/Desktop/externalServers.txt ...
3
votes
2answers
51 views

Using a glob pattern as an argument to “which”

Is it possible to use the which command on a glob pattern to return multiple results? For example, I want to know the full path of all my latex commands. I can try: ...
1
vote
2answers
63 views

how to insert many similar records in mysql at a time?

we know that we can insert multiple records at a time using this query: INSERT INTO `TABLE1` (`First`,`Last`) VALUES ('name1','surname1'), ('name2','surname2'), ('name3','surname3'), ...
1
vote
2answers
171 views

Will a '*' (star) in globbing match only characters (i.e , a-z and 0-9)?

I havie a simple question here: does a * (star wildcard) match only characters (letters and numbers) in glob style? Or will it also match special characters? In bash, * matches everything, while in ...
2
votes
2answers
87 views

how to show total files size in a folder by filtering extension without showing each file size

du -hc *zip shows me total size of zip files in a folder, but it shows also every single file size of the folder. I only need total size. Is there way to show the total size of a folder without ...
0
votes
6answers
136 views

How to list files starting with “a” or “c” from /etc.

I tried ls /etc/[ac]* but it shows directories starting with a or c, and their entire contents, not the files starting with "a" or "c".
2
votes
1answer
45 views

Globbing fails in zsh, but works in bash

I have an alias in bash, that I'm trying to port over to zsh. I thought it may have been the alias itself, but now it seems it's just the globbing. grep -irl --exclude=\*.{log,class,fuegoclass,dat}* ...
2
votes
1answer
40 views

scp wildcard not working in zsh

I have switched over to zsh, and it is working fine. One strange thing, when I try to scp with a * wildcard, it does not work, and I have to drop into bash. The second command below works fine. Any ...
6
votes
2answers
351 views

Copying one file to multiple directories

I have a file that I want to copy to another 60 directories. The best way I can think of doing this is by making a bash script that has instructions to every folder like this: cp script.sh ...
2
votes
1answer
93 views

Move extension-less files with mv

I have a folder with images(png, bmp, jpg) and extension-less files. I cant figure out how to move only the extension-less files. They are all random numbered files.
5
votes
2answers
95 views

ls command: how to ignore case without globbing

I use the shopt -s nocaseglob command to ignore case, but it seems like it doesn't work if I use a string without glob. Just a question out of curiosity, is it possible to ignore case without ...
4
votes
1answer
52 views

Use rsync to just get a folder and its content with a pattern

I've looked all around the internet, looked in regexp sites and everything else, but I'm unable to write a rsync command to fetch what I want to. I need to mirror the FreeBSD release, but I don't ...
4
votes
4answers
593 views

How to exclude some files not matching certain extensions with grep?

I want to output all lines containing the word OK recursively from a directory. But there are a few extensions which I need to exclude from the result: *~ *.map *.js except *.debug.js I tried: ...
4
votes
2answers
250 views

Script to loop through folders with numeric names

I am working on a bash script to compress the images in my Wordpress folders. The wordpress folder structure is as follows: > wp-content/uploads/2014/01/filename.jpg > ...
1
vote
2answers
68 views

tar specific files based on a pattern

I got a lot of files with the following format: 2014_04_01_11.txt 2014_04_01_12.txt 2014_04_01_13.txt 2013_03_25_12.txt 2013_04_29_15.txt I would like to tar all theses files into an archive 20?? _ ...
2
votes
1answer
82 views

Specifying full range of printable ASCII characters in a glob pattern

I want to use a globbing pattern to match only printable (including space) ASCII characters 0x20 through to 0x7e. This is being used inside a super super.tab database. I've arrived at the pattern: ...
4
votes
1answer
998 views

Why is my find not recursive?

I am running the following command, but it is not performed recursively: find . -name *.java I know there are java files further down in the current directory but it is performing the find on the ...