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.

learn more… | top users | synonyms

10
votes
2answers
10k views

How to Combine find and grep for a complex search? ( GNU/linux, find, grep )

I'm trying to do a text search in some files that share a similar directory structure, but are not in the same directory tree, in GNU/Linux. I have a web server with many sites that share the same ...
6
votes
5answers
5k views

Is there a smarter Find files utility for Windows 8 than Windows key + F?

Is there any utility for Windows 8 that will basically do the same thing the old "Find" dialog in Explorer did? Often times (many times a day) I need to find a particular file, and I don't know the ...
2
votes
2answers
2k views

How can I find files NOT matching a specific extension in Windows XP?

I need to find and delete all files in subdirectories that are not .SQL files. I can't figure out how to search for <>.SQL or !.SQL in Windows Search. Most of the solutions that I've seen here ...
3
votes
5answers
14k views

Find document files and copy them to another directory

This is a bit of a basic question but I'm trying to copy all .doc files I find in a directory and copy them to another directory. I know each command: find -name '*.doc' . and: cp filename ...
1
vote
4answers
14k views

Find all files older than one 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 it the other way around, find files modified in the last 60 seconds with -mtime -60s, ...
186
votes
6answers
121k views

How to chmod 755 all directories but no file (recursively)?

How to chmod 755 all directories but no file (recursively) ? Inversely, how to chmod only files (recursively) but no directory ?
44
votes
12answers
54k views

Unix/Linux find and sort by date modified

How can I do a simple find which would order the results by most recently modified? Here is the current find I am using (I am doing a shell escape in PHP, so that is the reasoning for the variables): ...
33
votes
4answers
29k views

How can I recursively copy files by file extension, preserving directory structure?

At the Linux command line, I'd like to copy a (very large) set of .txt files from one directory (and its subdirectories) to another. I need the directory structure to stay intact, and I need to ...
31
votes
3answers
13k views

How do I execute multiple commands when using find?

I'm trying to run multiple commands on things I have found, how can I achieve this? find . -exec cmd1; cmd2 does not seem to work; it instead runs cmd2 after cmd1 has been executed on every file.
11
votes
3answers
3k views

Is there any way of making Ctrl+f in Chrome use the selected text, as per Firefox?

One thing that's really bugged me since switching to Chrome is that Ctrl + F behaves slightly differently from Firefox. In Firefox, if you have text highlighted and hit Ctrl + F, it'll start finding ...
4
votes
2answers
2k 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 ...
4
votes
1answer
3k views

Bash Find Files with zero size and delete files with different extensions

This command will find files of zero size: find . -size 0 A filename returned might be filename.001 I am looking for a one liner that will delete files found with this, plus any that have the ...
3
votes
4answers
2k 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
2answers
28k views

If an Excel row contains particular words, return that row, highlight that row, or give Y/N for that row

I have a sheet containing thousands of cells in a column. These cell contains names of different securities. Some names of these securities contains a particular string such as "C/O". How can I use ...
43
votes
4answers
47k views

How can I find files that are bigger/smaller than x bytes?

In a terminal, how can I find files that are bigger or smaller than x bytes? I suppose I can do something like find . -exec ls -l {} \; and then pipe the result to awk to filter by file size. But ...
36
votes
5answers
5k views

Invoking vi through find | xargs breaks my terminal. Why?

When invoking vim through find | xargs, like this: find . -name "*.txt" | xargs vim you get a warning about Input is not from a terminal and a terminal with pretty much broken behaviour ...
2
votes
2answers
3k views

Renaming multiple files which match UNIX find keyword

I have the following output from find command for finding files containing yyy in name: ./plonetheme/xxx/yyy-logo.png ./plonetheme/xxx/profiles/default/plonetheme.yyy_various.txt ...
1
vote
2answers
4k views

How list file by range of date?

I would like to list files with 3 days years old. I found this one at stackoverflow: find . -type f -printf "%-.22T+ %M %n %-8u %-8g %8s %Tx %.8TX %p\n" | sort | cut -f 2- -d ' ' | grep 2012 But I ...
8
votes
3answers
3k views

avoid permission denied spam when using find-command

I often try to find files with following syntax: find . -name "filetofind" However it usually results as many rows or error reporting (Permission denied) about folders where permission is denied. ...
6
votes
3answers
6k views

How-to limit Unix FIND results number

Is there a way to limit the number of results returned by the FIND command on an unix system? We are having performance issue due to an unsually large number of files in some directories. I'm tryging ...
3
votes
1answer
6k views

Batch File that copies the first 2 lines of a text file into another text file

I have a text file A.txt Pinging [xx.xx.xx.xx] with 32 bytes of data: Request timed out. Ping statistics for xx.xx.xx.xx: Packets: Sent = 1, Received = 0, Lost = 1 (100% loss) I would like to ...
3
votes
2answers
2k views

Is it possible to find all files with a given inode? Efficiently?

It is possible to find all the paths to a file with a given inode, in general, using find's -inum option. But this has awful performance for typical filesystems. What options are there to improve ...
3
votes
2answers
316 views

Why might -exec affect the output of find in Linux?

If I run this command... sudo find /storage -name "*~" -or -name ".*~" -or -name "#.*#" -or -name ".DS_Store" -or -name "Thumbs.db" ... it gives me a list of matching files, as expected. However, ...
2
votes
2answers
1k views

Find difference with mtime - and +

Can someone explain the difference with mtime - and + switch as both are not bringing back the results I need. I'm looking to delete all files older then 5 days find /mnt/sdb1/tmp/ -type f -mtime +5 ...
2
votes
2answers
2k views

Why doesn't 'find' prune the way I think it should?

I'm running MacOSX 10.5.8 I run the following: ~/Sites/jjprof/trunk/content > find . -type d -name '*svn' -prune ./.svn ./resources/.svn ./resources/sitewide/.svn ./temporary/.svn ./users/.svn ...
11
votes
4answers
7k 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 ...
4
votes
3answers
817 views

Find out where $PATH is defined

I recently installed an Arch-Linux System. If I type echo $PATH it points (among others) to a directory inside my /home/user/dir I can remember I set up somewhere. I have it as root user also, so ...
3
votes
3answers
348 views

Why doesn't this for loop work?

This is on Ubuntu 12.04 I'm trying to figure out how to get ffmpeg to do a batch conversion of FLACs to MP3, recursively. If I cd into a directory and use for f in *.flac; do ffmpeg -i "$f" -c:a ...
3
votes
2answers
496 views

Chrome extension for highlight+find prepopulate?

I switched from Firefox to Chrome as my go-to browser some months ago and there is one piece of functionality that still pesters me. Seems trivial/ignorable but this one is driving me nuts little by ...
3
votes
1answer
3k views

How to make all files non-executable recursively using find without affecting directories?

I need to strip the executable flag from all files within a certain directory and sub directories. Right now I'm doing it with a 2 step process find /dir/ -type f -exec chmod ugo-x {} \; find /dir/ ...
3
votes
2answers
818 views

Excluding a list of directories from Find

I am using rsyncrypto to backup a few of my user directories. I want to exclude some subdirectories from the encryption. I read that the best way to do this is to pipe the output of find to ...
3
votes
7answers
2k views

UNIX find dirs that contain a particular file (pom.xml) then execute command in that dir

I want to, from a root dir, find all dirs that contain a certain file name (pom.xml), then cd to that dir and execute a command. I can do this in a script but I was hoping to do this with a single ...
1
vote
2answers
1k 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 > ...
0
votes
1answer
186 views

Find & du to calculate total size vs xargs

Can someone confirm that the following one liner will produce the total human readable size of all the directories which FIND locates as having log in the name? find -type d -name *log* | du -hcs
0
votes
3answers
375 views

How to print out all non-hidden files recursively in a dir using lpr

find . -type f | grep -v '/\.' lists out all non-hidden files in the current dir recursively. Example of this command given the following file tree . ├── css │   ├── base.css │   └── main.css ├── ...
0
votes
2answers
2k views

find: missing argument to `-exec' when executing the find command in Linux [closed]

I get the error find: missing argument to-exec'` when I attempt to run the command find . -maxdepth 1 \( -iname \*.png -o -iname \*.jpg \) -exec echo {} \; The reason I am using echo is because I ...
0
votes
1answer
286 views

Exclude all hidden directories in UNIX find

I'm doing a word search using the following command: find . -exec grep -q [some_word] '{}' \; -print -o -name .svn -prune -o -name .ssh -prune -o -name .boneyard -o -name log -prune -prune -o -name ...
0
votes
1answer
131 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
1k views

How can I find all PHP files with group write permissions?

I've been trying to get the -perm option of find to give me all PHP files that are group writable. Should this work? find -name "*.php" -perm g-w Thanks!