Questions tagged [find]
The find command in Windows systems is used to filter lines of input text, and return those matching the filter. The find command in *nix system is used to locate files or folders that match a certain criteria.
1,044
questions
1
vote
2
answers
4k
views
Using wildcard in unix find command's path
This command with a * in the find path works fine on the local server
Svr1$ find /path/*/foo/ -name "*20160208"
When I try this remotely from another server it doesn't work
Svr2$ echo $Pswd|ssh ...
3
votes
2
answers
3k
views
Unix find not working with a wildcard in the path when ssh'ing
This command with a * in the find path works fine on the local server
Svr1$ find /path/*/foo/ -name "*20160208"
When I try this remotely from another server it doesn't work
Svr2$ ssh Svr1 find '/...
10
votes
2
answers
352
views
Windows 7 - Find all files that are alone in a folder
I need to find a way to select all files that are alone in their folders, so I can cut and paste them someplace else. All respective folders are inside one main root folder. Is there a command prompt, ...
1
vote
1
answer
899
views
Looping through wildcard folders and executing multiple commands in Bash
I have a set of commands to change the contents of files called MenuSettings which work fine when directed to a folder.
cd /Applications/snowflake/table-updater/Testing/Applications/Salford_100
sed ...
3
votes
1
answer
90
views
Is it possible to suspend/restart a 'find' command?
Let's say I have a slow filesystem in which I would like to list all the files:
find . -type f -printf "%p\n"
Is it possible to launch this command in a way I can interrupt it, save the state and ...
0
votes
1
answer
595
views
Quote a command for `find -execdir test [command]` (Bash)
I would like to execute following command to do git fetch in git repos if the have a remote (= git remote is non-empty):
find -name .git -execdir test $(git remote) \; -execdir git fetch
...
9
votes
3
answers
11k
views
Use of the "OR" Regex operator with the find command
There are so many of these questions on the net, but I was unable to solve this simple problem.
I have a directory with a lot of images, but I only want to copy a subset of them identified by ranges ...
1
vote
1
answer
1k
views
is it possible to search case insensitive search using command line [windows 7]
I use
grep -f d.txt OB.txt > r.txt
to get the result file.
But the search is case sensitive. Is there any case insensitive alternative to this?
0
votes
1
answer
1k
views
windows 8 find files modified in last hour
In windows 8 I am trying to find files modified in the last hour. After reading these two links I thought I could do this.
System.DateModified:YYYY-MM-DDThh:mm:ss
So I tried
System.DateModified:>...
2
votes
1
answer
2k
views
How do I find directories with a question mark in the name? Escaping not working?
I am try to find directories like
services-client?.git
using the command
find . -name *\?.git
but get all directories ending in .git
What I'm doing is downloading a file from amazon s3 and in ...
0
votes
1
answer
3k
views
Delete files if condition is met
I have the following directory tree:
/Directories/
/Directories/somedir/somefile.mkv
/Directories/somefile.rar
I'm trying to find a way to delete the .rar file if the .mkv file exists and is larger ...
2
votes
2
answers
589
views
compare and calculate two variables with multiple values in shell script
I have written three hive queries in shell script for calculating debit-credit and target amounts which output below values:
debit_amount : BOI 4760545.650000 AXIS 284.49000000 SBI 87.220000000 ...
51
votes
7
answers
74k
views
Find all files that are NOT of a specific type/extension in folder?
Windows 7 Ultimate 64bit:
I'm looking for a way to find all the files in a directory that are NOT of a specific file type or extension.
Example: I'd like to find every file that isn't an .mp3 in my ...
1
vote
2
answers
405
views
Use the same "find bar" in all tabs in Firefox
Before, the "find bar" (what you get by pressing ctrl-F) was the same for all tabs. But now it is separate per tab.
That is, if I write a word (e.g., "hello") in the bar, I go to another tab and I ...
3
votes
2
answers
1k
views
find command and support for media metadata
I have a folder with tons of disorganized files of all types with deep levels of subfolders and I want to find every audio file WITH 320kpbs (bitrate) and run something upon each of them without ...
1
vote
0
answers
2k
views
Find "mystring" in files and return only certain portion of matching lines
I have below command to list out every file in current directory and it's sub-directories containing "mystring" along with the line where search string match is found.
@echo off
setlocal
findstr /s ...
0
votes
1
answer
170
views
Excel FIND.VERT with partial text in a keyword table
I need a particular function and I think that it doesn't exists in standard Excel and probably I need a custom VBA function.
This function should do something like FIND.VERT but with particlular ...
1
vote
1
answer
213
views
Unix find -size -1G ignore files which were returned by find -size -900M? [duplicate]
I need to tar-gzip files below a certain size in a directory. I tried the command suggested from this post and it works, but when I changed the argument for find -size to -1G, it ignores some files ...
0
votes
6
answers
3k
views
A better way to search for a string within a file?
I am trying to find a particular string of text in a file somewhere on my hard drive. The best I have come up with so far is:
find -type f / | xargs cat | grep "string to find"
But this just tells ...
4
votes
4
answers
10k
views
Find | grep doesn't work in Cygwin
I have cygwin installed and when I search for the source code with this command nothing show up, even that I have that string in a file
$ echo foo > bar
$ find . -name '*' | grep foo
Nothing ...
-1
votes
1
answer
69
views
Linux find files that differ from a given date
i would like to search for file that has not a give date.
for example i want to find in my server all file created before 2015-12-01 o after
any suggestion ?
thanks
luca
refer also to Command to ...
5
votes
3
answers
7k
views
How do you search for strings in a file which in turn is in an archive?
I can search through a number of files for a particular string by pipelining 'grep' and 'find' commands.
Now, I have some 10 zip files each of which has archived a lot of text files. Is there any ...
1
vote
2
answers
280
views
How to purge all tabs for spaces in all C files in a directory?
I'm trying to fix the style in a directory of about 60 .c and .h files. This can be taken in steps (e.g. I don't have to figure out find and vim script syntax at the same time), but ultimately I want ...
6
votes
3
answers
14k
views
Using find or grep to locate filenames with accented characters from a different encoding system (Windows to Linux)
I tried to tag late onto a question similar to mine on stackoverflow (Find Non-UTF8 Filenames on Linux File System) to elicit further replies, with no luck so far, so here goes again...
I have the ...
0
votes
2
answers
191
views
remove pattern with random numbers (digits) from php files
I am trying to remove or replace the digits ((random numbers)) in big numbers of php files using find & xargs and grep with sed etc .. the numbers looks like that
inside the php file
/web/...
45
votes
2
answers
51k
views
Use rsync to copy all files except for certain filenames with a certain extension
I have two same-size flash cards, and I want to copy contents of one to the other based on the following rules:
I want all directories and subdirectories in place
I want to exclude files of type .FOO,...
0
votes
1
answer
50
views
Discrepancy finding and counting all files on the system
I have been researching the different methods of counting up all files on my system. In my case, I want all the files starting at / and going into subfolders. Here is what I have come up with so far:
...
0
votes
1
answer
4k
views
how to move files that contain string using find, xargs, grep, in linux
i have many php files maybe over Three million..
how can i use grep with xargs and find with mv to find contain the string in files and move them to directory if they match.
I try like that
find . -...
0
votes
1
answer
198
views
Why the find cmd is not working inside /sys/class?
I was looking for this file:
/sys/class/backlight/intel_backlight/brightness
So I tried searching for it using this cmd:
sudo find /sys -name "brightness"
But it doesn't find it. I can go in the ...
0
votes
2
answers
169
views
Powershell to find value and create file
I am new to powershell, was hoping for some help. I am looking for a powershell command that will search through a file and find a string and create a file based on that string value that is found.
...
1
vote
3
answers
825
views
Renaming files fetched via “wget --mirror” in Bash before uploading to an Amazon S3 statically hosted area
I’m trying to archive and upload an old website to statically hosted Amazon S3 area.
I was able to get the contents with wget, using the following command:
wget --mirror --no-parent --html-extension ...
2
votes
1
answer
2k
views
How to remove files using find's multiple -name parameter?
How to remove files, containing tilde in the filename or extension, recursively?
For example, files of the vim, with the names like .my_file.c.un~?
I'm using this find sequence for that:
find . -...
1
vote
1
answer
144
views
How to use the find command such that it matches from the innermost directory?
Say that I have the following file
this/is/my/file.txt
Can I search this file given that I only know the file is in /my/ directory ?
2
votes
1
answer
60
views
Regular Expression notepad++ deleate comments in ( )
I am currently working with notepad++ and would like to deleate text between brackets togeather with the brackets themselves! I would like to use a regular expression.
Example:
(thisIsAnExample)
...
1
vote
1
answer
55
views
Pruning the Find command
I have the following command I run to grab all users in /Users minus any admin account, guest, shared or beginning with a "."
find /Users -type d -maxdepth 1 -mindepth 1 ! -name admin ! -name Shared ...
5
votes
1
answer
6k
views
understanding some flags in find-command in linux
I wanted to move only files in Linux and I found the answer here as the following:
find . -maxdepth 1 -type f -exec mv {} destination_path \;
which worked for me perfectly. But my questions are:
...
-1
votes
2
answers
762
views
linux find command to keep only .h files
I have a source tree have lots files with different file types.
The source tree has many sub folders.
How do i keep the folder structure of the source tree and delete all files besides .h files?
0
votes
2
answers
182
views
confuse about find - print and prune option (unix)
compa> find . -type d
.
./2015_08_30
./2015_08_25
./2015_08_27
./2015_08_31
./2015_08_24
./2015_08_26
compa> find . -type d -print
.
./2015_08_30
./2015_08_25
./2015_08_27
./2015_08_31
./...
0
votes
1
answer
665
views
Copy matches of recursive search to a new location
I want to search a directory recursively and copy all XML files to a new location. I can identify the files with:
ls -R | grep .xml$
or with full paths with:
find . -name \*.xml
Results of normal ...
0
votes
1
answer
1k
views
copy files to other folder - find
I have to copy files to folder with name with their type using command 'find'. There are a lot of files with a lot of folders. I tried command:
find ./find -type f -exec bash -c ' file -b "$1"|cut -d ...
1
vote
1
answer
1k
views
The correct way to use find prune
Facing the same problem as Why doesn't 'find' prune the way I think it should?,
but that accepted answer doesn't work for me:
Here are my files:
$ find .
.
./resources
./resources/...
3
votes
1
answer
98
views
Trying to create a shell script to move all files with a certain year in their name to a year based directory
Here is the block of code that I have so far. No matter what I do with the find command, I can't seem to get it to function as I want. Trying to move all files with these long year names into their ...
1
vote
1
answer
270
views
How to grep in Windows for for eval code?
I have written this code in Linux, How can I achieve the same in Windows server ?
find "dirname" -name "*.php" -exec grep -PHl "(eval\(.*\);)" {} \;
Basically I want to find out this pattern
...
2
votes
2
answers
62
views
How can I find a particular named file within a particular named directory that could be anywhere in file system?
I am trying to find a file within a directory where both the name of the file and the name of the directory are known. For example, say I want to find
"...don't know this part of file path stem).../...
1
vote
2
answers
567
views
Finding php files that have numbers in the filename
Can someone help me with a command line to find all .php files on a server with a number in the filename?
I have searched, as best I can, for other answers, but they typically show for a specific ...
0
votes
0
answers
33
views
Start text search from focus point in chrome
In chrome, when I start typing for a text search, it searches from the beginning of the document rather than from where I am looking in the document. Is there a way to do the latter? (currently I have ...
2
votes
1
answer
38
views
Why does the behaviour of find(1) differ when explicitly adding -print?
The man page for find(1) says:
If the expression contains no actions other than -prune, -print is performed on all files for which the expression is true.
However, there seems to be a ...
0
votes
2
answers
467
views
Find files to find multiple instances of the same code with Notepad++
I might have inserted <meta charset="UTF-8"> twice in some HTML files, and there are too many of them to check manually.
Is there a regular expression I can use with Notepad++ to search for ...
5
votes
2
answers
3k
views
How can I use sed to alter the results of find and pass the results to cp?
In solaris, I'd like to copy all files found by the find command to a slightly different path. The following script basically executes cp for each file found by find. For example:
cp ./content/...
0
votes
1
answer
65
views
find certain item of a file by using command line tool in windows 7
recently I used
findstr "ItemThatIsBeeingSearchedFor" C:\Windows\System32\drivers\etc\hosts > J:\documents\HostsFile\ResultOfSearch.txt
in order to output a certain entry of the hosts file into ...