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

1
vote
1answer
17 views

find . file -/+ size except *.filetype

Alright what I am looking for is a way to do something that can find all files less than size except filenames with an extension or more. May be more than one. find . -type f -size -20M -name /! ...
2
votes
0answers
12 views

find using regexp and echo matches

I have about 50 users in /home/ directory and I have cloned a git repository to everyone: Executed at /home/ as root user: find . -maxdepth 1 -type d ! -name . -prune -exec git clone ...
0
votes
1answer
20 views

Using find and wc -L to find files containing lines longer then 500 characters

I have this command: find . -name "*.php" -exec wc -L '{}' \; And I believe it gives me the count of the longest line for each file. But I'm looking for a way to only print out the count and file ...
2
votes
1answer
18 views

Are there limits to file length piped from find to xargs or using find -exec +

In question [ Find and delete all the directories named "test" in linux ] on this site, the best answer talks about using these two commands: find . -name test -type d -print0|xargs -0 rm ...
4
votes
3answers
46 views

Using Unix's find command to find directories matching name but not subdirectories with same name

Edited: I mistakenly misrepresented my problem. A more accurate example now appears below. I'd like to recursively walk all directories inside a target directory, and stop each recursive call after ...
0
votes
1answer
17 views

How do I extract multiple files at once?

I have a number of rar files stored like so: /torrents/televisionshowS01E0$X/nameoftelevisionshow.rar where $X is a variable ={0,1,2,...,12} I would like to extract them using a single command to ...
0
votes
1answer
19 views

mdfind -onlyin not working in hidden directories recursvily? How to use it properly?

I am trying to find all files named doc.py in one of my virtualevns (called data_science), which are all in hidden directory .virtualenvs under /Users/adni and so I go: mdfind -onlyin data_science ...
0
votes
1answer
33 views

Why result of find command in linux is unsorted?

When I do a find the results are apparently in random order, shouldn't they be sorted by name?
0
votes
1answer
28 views

Two ways - two different results

I ran two seperate commands each one produced a different number. Can anyone help me figure out why? find -type d -name *log* | du -hcs find . -type d -name '*log*' -print0 | xargs -0 du -hcs
0
votes
1answer
38 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
1answer
24 views

Find and delete line in .htaccess file

I am trying to figure out how could possible a command do search and delete line from .htaccess file . the following line is the line i want to search and delete RedirectMatch ...
1
vote
2answers
21 views

Find all php files which first or second line has more than N characters

I would like to find all php files on my server which first line or second line has more than N characters. I would like to print both the file name and the line content that was found. How would I ...
1
vote
1answer
14 views

Find word that has more than 50 characters in all php files

I am trying to use find in combination with grep to find all the php files in my web server which have a word (any sequence of characters except whitespace) with more than 50 characters. I have this ...
1
vote
2answers
43 views

How to find files which do not contain their own filename

When using templates to generating files, it's important to include the template's name inside the template. When reading a generated file, it helps you find the template used to generate it. I want ...
0
votes
1answer
19 views

How to find files that contain a string in its content OR the path?

Find and grep does not work afaik because I need to create a list of files that satisfy EITHER requirement, not both. I assume this requires more than a one-liner. Any suggestions?
0
votes
0answers
25 views

I'm trying to list size of folders plus selected files on a portable disk

For the purpose of finding the location of my data among many portable disks, I'm trying to create plaintext lists of the contents of all folders and files of certain extensions and sort them by size. ...
0
votes
3answers
49 views

How to exec two commands in one find

I would like to find specific folders echo their name ls -l their contents My problem is that I don't know how to combine an echo {} and an ls -l {} in one find command. line for echo: sudo ...
-2
votes
1answer
37 views

Why does find take so long

When using find to search for a file name (locally mounted drives only) why does it take so long? Is it searching more than just the catalog?
0
votes
0answers
19 views

Lost executable +x permissions after home folder encryption

I have encrypted my home folder, where I have many compiled installations of Qt, and now every executable file in all those installations have lost their +x flag in permissions, and I can't execute ...
1
vote
2answers
71 views

Trying to find folders that only contain one file

I would like a find command (or similar) that when pointed at a folder, it would list all the files that live inside that folder or any of its subfolders, but only if the folder contains a single ...
1
vote
2answers
25 views

Find two newest change files and compare them

I have a script that wgets a .txt file and datifies the names. I'd like to diff the changes between the newest & next-to-newest file. This is how I am able to select them: ls -t -l | awk ...
0
votes
0answers
62 views

find command with exec sh doesn't work in shell script but in commandline (raspberrypi)

I want to find "old" folders in /volume1/photo/ipcam which are named like "????-??-??" and move corresponding folders within dropbox (with the same directory structure /ipcam/...) to the subfolder ...
0
votes
1answer
17 views

post-order for find -exec?

I want to remove certain directories from a hiearchy using 'find -exec' find $rootdir -type d -name target -exec rm -rf {} \; I get error messages find: `foo/bar/target': No such file or directory ...
1
vote
3answers
36 views

Is there a way to use > operator in find -exec

I'm trying to empty lots of files under a certain folder. >file or cat /dev/null > file or echo "" > file can empty file. find . -type f -exec blahblah {} \; can find files and do something ...
1
vote
1answer
41 views

Combining two linux commands

Im trying to use mergecap to merge 15 old pcap files in a folder. I tried to use FILES=($(find /mnt/md0/capture/DCN/ -maxdepth 1 -type f -name "*.pcap" -print0 | xargs -0 ls -lt | tail -15 | awk ...
0
votes
2answers
28 views

grep out condition and add the values of the grep value

I have a scenario that a csv file has the values of : abcd FAILURE 7 abcd SUCCESS 12 efgh SUCCESS 3 efgh FAILURE 5 mnop SUCCESS 6 mnop SUCCESS 4 abcd FAILURE 5 efgh SUCCESS 2 mnop SUCCESS 1 ...
2
votes
1answer
39 views

Simple find and copy script for linux [closed]

I'm quite a newbie to scripts in Linux. What im trying to get is a simple script that finds a file by its exact name, then copy that file to a different folder. So Essentially it should work like ...
1
vote
3answers
49 views

Unix delete with find: Delete all files that are listed in a file

In my root directory, I have a couple folders named something like AA, BB, CC etc., each containing files in the format AA1001.txt, BB1002.txt etc. In my root folder, I also have a file all_to_delete ...
1
vote
0answers
39 views

How to find and replace in the bookmarked lines in notepad++

I have a problem about how to find and replace in the bookmarked lines in Notepad++. For example my line is <content:encode><em>.... So I bookmark the lines that have ...
0
votes
1answer
51 views

How to find and replace in the between tags in notepad++

I have a problem about find and replace in notepad++. I want to find a space+space in text and replace with just one space. But the area I want to find and replace is between tags (ex: ...
1
vote
2answers
24 views

Excluding a file from UNIX “find” results based on existence of another file

I have a big bunch of directories, each with a series of .pdf files. Some of these files have successfully converted to .csv, some have not. An example directory listing using find ./: ...
0
votes
1answer
84 views

How to find special characters in Linux Vim

I want to find special characters in a text file. It is known that the UTF-8 encoded file contains Chinese characters , "-", "^A"(control-A, which is one of special characters), numbers, ...
0
votes
0answers
17 views

Finding files that are mostly NUL

I've got a hard drive copy that went bad where many files are of correct size but are completely filled with NUL (0x00) bytes. However, a couple of the files seem to have a couple KB of actual data. ...
2
votes
1answer
32 views

*nix find -type flag: can it accept multiple types?

I want to use find for getting all simlinks and regular files. I can use the -type for these individually, and I can use -o to string them together, but I apparently can't do -type fl. Is there a way ...
1
vote
4answers
75 views

String Search: find and grep and?

Task: 1) find a string 'decor' inside files in a directory 2) get # of occurrence for decor for each file that has it The first part of the problem is partially solved with find . -type f | grep -i ...
1
vote
1answer
68 views

Find the largest file in directory without size in output

I need to find the biggest file Only one file should be listed Search should work in given directory and subdirectories Output should display absolute path to the file with filename find "$PARAM" ...
1
vote
2answers
28 views

Configure find not to even look in directories, if directory name maches 2012

I'm using find /home/myid/dir-with100directories/ -mmin -5 -not -path "*/2012/* to find all files, except not in directory 2012, but somehow it works really really slow. And my guess is that find ...
1
vote
1answer
31 views

How is the OR boolean in find command?

How do you tell the find command to find string a OR b? Like: find . -type f -iname "aaa" OR "bbb" Any ideas?
2
votes
1answer
42 views

find -mtime fails to return results that ls -l show are there

On a Red Hat Linux system, I have a directory with several hundred files. I wanted to delete all files older than 24 hours. I did the deletion using find . -type f -mtime +1 -delete. Trivial stuff, ...
1
vote
2answers
124 views

batch find/replace using sed or awk

In every file with filename matching pattern1 I want to search for lines which start with pattern2, and add some string in a new line above those matched lines. As a simple example suppose I'm ...
1
vote
2answers
47 views

How do I search for a string in a group of files when some of those files contain spaces?

I'm running Mac 10.7.5. In a terminal, I'll use this command for finding files with strings find src/main -name "*" | xargs grep -i 'mystring' However when the files contain spaces, I'll get ...
0
votes
2answers
234 views

using awk with find -exec

I have a directory structure with 14 directories containing a bunch of files containing data in a three-column format (separated with tabs). I intended to use find and awk to extract the second column ...
3
votes
2answers
127 views

Is there anything faster than `find . | wc -l` to count files in a directory?

Not uncommonly I have to count the number of files in a directory, sometimes this runs into the millions. Is there a better way than just enumerating and counting them with find . | wc -l ? Is there ...
0
votes
0answers
14 views

How to use find with -delete when looking for directories

I know I can do find . -name '*.pyc' -delete But when I'm loooking for specific directories, -delete fails reporting that directories are not empty. Is it possible to force find to delete non ...
3
votes
1answer
195 views

How to find a file whose size is less than 10 MB?

I need to find a file in my current directory whose size should be less than or equal to 10 MB. ls -lh gives me the file size of each file but not sure how to find the files whose size are less than ...
0
votes
0answers
50 views

Does FIND (+ FINDSTR) use the indexed Windows search system (that is, the stuff I can select/deselect under ‘Indexing Options’)?

I added a test file (a 540 MB .txt file) using ‘Indexing Options’, rebuilt my index, and then tried searching for a string I know for sure is in the file. I then searched for the string using (1.) ...
0
votes
0answers
48 views

Two questions about FINDSTR and FIND on Windows 8

Can someone tell me how to limit the search results produced by running a FINDSTR or FIND command line search on Windows 8? I am searching a gigantic folder of text files and getting way too many ...
0
votes
1answer
46 views

moving the directories using find command

I am trying to find particular directory in one path and move the directory in other path using find. Source directory looks like below, /Dir1/country1/month1/date1,date2,date3 ...
1
vote
3answers
59 views

Move multiple files from filename list to a new folder

I have a list of filename in list.txt, which have 'abc1.png, abc2.png, abc3.png....'. However, I don't know the directories where the files are. I want to find all files in the txt file, and move ...
0
votes
1answer
46 views

'Du' command does not list all files

I receive different number of files with du -h and find: loom@loom-desktop$ du -h ~/storage/Apps/*/trunk/test/*.cpp | wc -l 35 loom@loom-desktop$ find ~/storage/Apps/ -path */trunk/test/*.cpp | wc -l ...