The find tag has no wiki summary.
2
votes
1answer
20 views
Linux “find -regex” doesn't handle binding
I have the following files, and need to match them like:
./foo.bar1.sh -match
./qux/foo.bar2.sh -match
./foo.sh -match
./baz.sh -no match
./foo.bar3 -no ...
3
votes
2answers
42 views
How can I retain grep's match highlighting when piping find into grep?
If I run grep foo bar.txt, grep highlights each occurrence of "foo" in bar.txt. But sometimes I want to use find to determine which files grep searches. So I do something like this:
find . -iname ...
2
votes
2answers
37 views
How can I avoid descending certain directories with 'find'?
Currently I have this find command which avoids descending particular directories:
find . \! \( -name ".hg" -prune \) \! \( -name "localhost" -prune \) \! \( -name "logs" -prune \) -type f
The ...
1
vote
2answers
42 views
Why does Find in Excel give unexpected results?
I would like to find all cells containing the number 18 in an Excel 2007 worksheet where the numbers are in a column with entries in General format (both numbers and strings).
When I use the Find ...
-2
votes
2answers
55 views
Can't find the path to proxy.pac file in OS X
I need to control my proxy.pac file in OS X, but I couldn't find it anywhere.
I used
whereis proxy.pac
from terminal too — the whole story short: I want to find the path to a file in Mac OSX.
1
vote
0answers
11 views
Finding sub-directories inside directories with same name using find and xargs [closed]
Possible Duplicate:
Finding subdirectories inside all directories with the same name
I want to run a command line to achieve following 3 steps:
find all directories named "inc" under a ...
2
votes
4answers
64 views
Finding subdirectories inside all directories with the same name
I want to run a command to:
Find all directories named "inc" under a folder "X".
List all the subdirectories under each "X/.../inc/".
Redirect the output to a file named "list"
I tried various ...
0
votes
1answer
78 views
Find and move hidden files from sub-directories with batch file not working
I'm trying to use this batch file to find and move files... but it does not work on hidden files.
What's missing?
@echo off
setlocal
set root=E:\backup
set dest=E:\Tmp
for /f "delims=" %%f in ('dir ...
-1
votes
3answers
81 views
Only output part after last “/” with find
This command:
find ./ -name "mybinaryrpm-1.0.24-1.1.i586.rpm"
gives the output:
./DirectoryName/SubDirectory/mybinaryrpm-1.0.24-1.1.i586.rpm
but I only want the output:
...
1
vote
2answers
39 views
How can I clear the contents of every file in a subdirectory without changing ownership / permissions?
I can find the list of files using something like:
find /path/to/files -type f
And I can clear the contents of a single file with any of:
> filename
echo -n > filename
cat /dev/null > ...
1
vote
3answers
73 views
Using `find` for multiple file extensions
I am using the following command for counting the lines of text in JAVA files:
find . -name '*.java' | xargs wc -l
How can I modify the find command parameters to match more than one file ...
0
votes
1answer
97 views
Using find -mmin to find files with modification time in the future
I can use
find . -mmin -5
to find files changed in last 5 minutes. However if I try to find files with modification time in the future by giving negative number find refuses to do it:
find . -mmin ...
0
votes
2answers
68 views
recursively delete but keep .gitignore file
I've been trying out several methods from SU but I have been unable to do this:
I got a folder (example: /var/www/tmp/) which contains several files and directories. I'd like to delete all the files ...
3
votes
1answer
69 views
Find and replace Notepad++
I have some URL like the following
http://www.SOMEURL.com/first-category/1343381-example-text-text-text-text-2000-a.html
What i want is to simple delete all of the text before and after the number ...
0
votes
2answers
41 views
Generate a files list and truncate it in 2 list of X Mb of files each
I need to generate a list of all files in a certain dir, and truncate it in X lists containing each one a fixed amount of data of files.
E.g.
I have 95 Gb of data.
generate the file list ...
0
votes
2answers
58 views
grep doesn't produce the correct output when run on find command
My task was to print the number of files in the current directory without using ls and wc commands.
I had typed the following lines in the script:
#!/bin/bash
find . -maxdepth 1 -type f \( ! -iname ...
1
vote
2answers
68 views
Search all files containing text
With Busybox, how do you search for an expression within a bunch of files recursively through a bunch of directories, but only look through text files?
We don't know what the file's suffix is going ...
1
vote
2answers
76 views
How to use command “find” to list files with specific filename length?
In my folder I got files like
/data/filename.log
/data/filename.log.1
/data/filename.log.2
/data/filenamefilenamefilename.log
/data/filenamefilenamefilename.log.2
I wish to use "find" command to ...
2
votes
1answer
116 views
Subshell arguments in -exec parameter for find(1)
Why doesn't
find . -type f -exec echo $(file={}; echo ${file:0:5}) \;
give the first five characters of the file, while this works:
find . -type f -exec bash -c 'echo ${1:0:5}' funcname {} \;
...
0
votes
1answer
36 views
escape file and directory names from find
How can I escape spaces and other symbols from the results of a find command? For example, this doesn't work if there are spaces and other symbols in the results:
find -maxdepth 5 -type d -print | ...
6
votes
4answers
98 views
How do I parse the output of the find command when filenames have spaces in them?
Using a loop such as
for i in `find . -name \*.txt`
will break if some filenames have spaces in them.
What technique can I use to avoid this problem?
0
votes
5answers
141 views
Using find command to list top 5 image files by size
All,
I want to list the top 5 image files (png,jpg) in a given folder.What's the best approach?
I'm using the following currently but it doesn't give the right output:
find . \( -iname \*.png -o ...
3
votes
6answers
58 views
BASH: Adding existing filecontent to an existing file
I've to add the content of a file to the end of every prefs.js file.
Tried it with find -name 'prefs.js' -exec more filecontent >> '{}' \; but it didn't work.
1
vote
1answer
51 views
What `find` command deletes everything in a directory except for CVS folders?
I have a dir:
$ tree
.
|-- CVS
| |-- Entries
| |-- Entries.Log
| |-- Repository
| `-- Root
|-- dirA
| |-- CVS
| | |-- Entries
| | |-- Repository
| | `-- Root
| |-- file1
| ...
0
votes
1answer
32 views
ls link count seems incorrect - how do I ensure I'm not deleting the inode contents?
ls -lai on a file gives me a link count of 2:
16508 -rw-rw-rw- 2 ...
Then looking for all the filenames returns only one:
find "$dir" -inum 16508
This lists only the original file, not two. ...
0
votes
1answer
46 views
How to find files, print some standard info about those files, plus print the alpha char count of each filename?
I want something like this:
find "$dir" -type f -printf '%i:<alpha_char_count_of_base_filename>:%d:%p\n'
Then I want to sort first on inode number, then on alpha_char_count_of_base_filename. ...
0
votes
1answer
23 views
Speeding up file search with a shell
Do you know any way to speed up file searching with a shell?
There is a lot of possibilities: find, which, whereis, ...
find seems to be the most useful, but it's very slow. Perhaps, I don't know ...
0
votes
1answer
66 views
Equivalent of unix find command on windows
What is the equivalent of unix find command on windows? I see that the "find" on windows is more like a grep. I am especially interested in the equivalent of "find . -name [filename]".
Many thanks in ...
2
votes
3answers
85 views
How can I search a file by its name and partial path?
Often I have a file name and it's partial path, e.g. "content/docs/file.xml".
Is there a simple way to search for that file, without manually cutting into parts its name to provide directory name ...
1
vote
2answers
70 views
How to use *nix find command to search for specific files with regular expression
In my centOS there is a lot of log files in my folder /log
/log/log.20120308
/log/log.20120308.1
/log/log.20120308.2
/log/log.20120308.3
/log/log.20120308.error
/log/log.20120308.error.1
Apparently ...
2
votes
1answer
63 views
find files with ACLs set
How can I find all files with some extended ACLs set, i.e. those with a little + at the end of the permission flags shown by ls -l.
I could not find a corresponding flag for find. My naive approach ...
1
vote
1answer
43 views
Is there a browser extension for any browser that allows two “finds” in the page with different highlighting colours?
With most apps including browsers there is a "Find" function for searching for text in the current document. All instances of matching text are highlighted to make them easy to see.
But sometimes you ...
1
vote
3answers
137 views
How to ignore certain filenames using “find”?
One of my favorite BASH commands is:
find . -name '*.*' -exec grep 'SearchString' {} /dev/null \;
which searches the contents of all of the files at and below the current directory for the ...
4
votes
3answers
108 views
how to limit find command's output used with option -print0
I'd like to limit output of find command. In the past I used to use for this ls command, e.g:
ls *tgz|head -100|xargs -i mv "{}" ../
but I got to know that the result may be unpredictable if name ...
2
votes
2answers
79 views
Flatten a folder structure to a file name in Bash
I'm trying to convert files from this structure:
foldera/folderb/filec.png
to:
foldera_folderb_filec.png
I'm halfway there:
find . -type f -name "*.png" | sed 's@^./@@g;s@/@-@g'
which ...
0
votes
1answer
48 views
How to find candidates of file duplicates based on a similarity of their names?
I am not searching similar images or photos (imagedupe) nor audio files!
I have a lot of media data here and I want to spot duplicates based on their file name. I know that there is fdupes, etc. but ...
0
votes
1answer
77 views
How to filter files with specific permissions or attributes while running ls?
For example, if I only want the files that have the permission g+s while running ls, how could I do this?
0
votes
1answer
50 views
How to find all files recursively except those in a certain directory
How can I find all files in a directory recursively, except those in the .git directory?
I tried the folowing: find . \! -name ".*" but that didn't work.
3
votes
3answers
220 views
'find' in linux supress the 'no such file or directory'
i'm new to linux.
I did RTMP. I am trying to find a directory with this command
find /users/dan/ -name 'Prams' -type d
I see a huge amount of 'No such file or directory' outputs. Is there a way ...
1
vote
2answers
64 views
Find/SED keeps ignoring some hidden files
Is there a way to ensure find/sed include hidden files during processing?
1
vote
2answers
128 views
Why is find exec grep > file an Infinite Loop?
I was trying to collect all of the Message-ID: headers (lines) in a directory with 200K .eml (plain text) files. A bit naively, I said:
find -type f -exec grep -Fi "message-id:" {} \; > ...
0
votes
1answer
75 views
How do I make “find” only match files in specific sub-directories
I'm using bash for Mac OS X 10.6.8.
Using the find command, I would like to search for files that match *.XML. However, I would like to match only those files in the 16xxxx sub-directory and not ...
0
votes
2answers
135 views
How can I use the find command to remove directories without eliminating certain subdirectories?
I am trying to modify the following command in a script that removes directories based on age.
Example directories would be the following:
/a/b/c/2011/11/11
/a/b/c/2011/11/11/12-ACD-1234
...
1
vote
2answers
109 views
List all files in a directory matching a string and copy output
I'm trying to create a series of playlists on my MP3 player, running Rockbox, by finding a file matching a string, using find /cygdrive/g/MUSIC -type f -name "Search Criteria" | ...
1
vote
1answer
36 views
Why does $ find -delete not work sometimes?
I think what I'm talking about is this part of the manpage, which is just barely too indecipherable for me:
-delete
... It will not attempt to delete a filename with a ``/'' character in its
...
0
votes
1answer
36 views
find command giving different outputs with/without -print
find src/ -name "*.cc" -o -name "*.cpp" -print
find src/ -name "*.cc" -o -name "*.cpp"
The intended behavior is to find all C++ files in a directory and all its subdirectories. As I understood it, ...
-1
votes
4answers
470 views
find all files older than 1 minute
How can I use find to select files that have been written and not modified in the last minute?
I know I can do the other way around, find files modified in the last 60 seconds with -mtime -60s but I ...
4
votes
4answers
610 views
Ubuntu grep, find etc: “Permission denied” and “No such file or directory” output
When I grep or find something I always get annoyed by the "Permission denied" and "No such file or directory" notice, smth like that:
johndoe@johndoe-desktop:/$ grep -rnP 'YII_CORE_PATH' ./ | grep -v ...
-2
votes
2answers
197 views
Shell script error using command find
My script is supposed to: recursively look for files and directories whose names contain given strings, using find, starting in the current directory. If no arguments are given the message Missing ...
3
votes
1answer
182 views
How to physically reorder files `03.mp3 01.mp3 02.mp3` (`ls -f`) in a directory?
The physical order of the files matters when I copy them onto my USB stick and listen in car mp3 player. Most of my music album folders are unsorted, e.g. ls -f may produce:
03.song3.mp3
01.song1.mp3
...