find is a command line utility to search for files in a directory hierarchy

learn more… | top users | synonyms

1
vote
2answers
21 views

Find a specific file in the nearest ancestor of the current working directory

I'd like to find a way to find a given file by looking upward in the directory structure, rather than recursively searching through child directories. There's a node module that appears to do ...
0
votes
1answer
4 views

How to Limit ContentMatches of Grep in List? [duplicate]

I know the thread here which proposals (... | cut -c 80) however give single letter outputs like n r s t p. I do # http://unix.stackexchange.com/a/293147/16920 find -L $(find . -type l -name 'Math*')...
2
votes
2answers
73 views

How to Find All .tex Files in Directories in Recurse Grep?

I want to expand the recursive search of symlinks to include only .tex files find . -type l -name "Math*" -exec grep -d "recurse" word {} +. Failed pseudocode 1 find . -type l -name "Math*" \ -exec ...
13
votes
5answers
527 views

Find files that contain multiple keywords anywhere in the file

I'm looking for a way to list all files in a directory that contain the full set of keywords I'm seeking, anywhere in the file. So, the keywords need not to appear on the same line. One way to do ...
1
vote
1answer
63 views

Why is find not listing matching files when preceded by an asterisk(*)? [duplicate]

On Ubuntu 14.04, 64 bit, I have set /lib/modules/4.2.0-27-generic/kernel/drivers to be my current directory. I intend to search all files having net present as a sub-string. If I search with a regex ...
3
votes
2answers
46 views

Remove old files in a directory except files present in an exception file

I am writing a shell script to delete old files (older than 60 days) in a directory except few files and these file names are maintained in an exception file present in another directory. I know the ...
1
vote
2answers
44 views

Find files with pattern and get latest one

I want to find file with specific pattern and print the latest file matching the pattern with full path find ../*.gz -type f -print0 | sort -nr | cut -d: -f2- | head -n 1 How do I print the full ...
1
vote
2answers
40 views

How does the -name switch to GNU find work when targeting a directory and its contents?

I have a folder full of source files for an application, the project uses git for version control and so there is a .git directory: ├── composer.json ├── .git │   ├── branches │   ├── config │   ├── ...
-1
votes
1answer
49 views

Recursively move files with different names and different extensions [duplicate]

How can I recursively find all audio and video files in a directory and move them elsewhere in a single operation?
2
votes
1answer
35 views

How to use “cat” command on “find” command's output?

I want to redirect the output of the find command to cat command so I can print the data of the given file. So for example if the output of find is /aFile/readme then the cat should be interpreted ...
2
votes
2answers
53 views

Pass input file through pipe as argument?

I have two issues. I am trying to pass files through a pipe as an argument, and I am trying to use that file as a variable inside the sh function. Here is my command: find . -name 'segment*' | ...
3
votes
5answers
296 views

Add space between files paths

I have a list of folders and inside every folder I have the file " file.txt" which has the same name in all the folders. I wanted to collect the path for this file from all the folders and save it in ...
1
vote
2answers
49 views

Find a folder excluding one

I would like to find a folder not named "STDF", then archive them. find /a/b/c -mindepth 1 -maxdepth 1 ! -path "STDF" -exec /usr/bin/gzip '{}' \; The above command is not working. Can someone ...
4
votes
1answer
39 views

How does find evaluate expressions?

find man page says that -print action has a value of true, so why does this command find /home \( -not -print \) always list all files in directory ?
-1
votes
1answer
68 views

How to find a dynamic folders?

Hello StackExchangers, I created folder like this : $folder_name=`date "+%Y%m%d"` $mkdir -p ${DIR_LOG}/${folder_name} Example of folders name: [20160622], [20160621]...etc Now I need to find ...
4
votes
3answers
311 views

Using `find` on not existing directory

Is there a simple way to make this silently do nothing, if /my-directory does not exist? find /my-directory -type f -mtime +14 -print0 | xargs -r0 rm Versions: find: GNU findutils 4.5.10 bash 4.2....
1
vote
1answer
51 views

Why getting these “Permission Denied”s in POSIX find-grep readable?

I do in Posix find $HOME +perm 0666 -type f -exec grep -l "XSym" {} \; but get this which I do not understand find: ‘/home/masi/.dbus’: Permission denied grep: /home/masi/.viminfo: Permission denied ...
0
votes
2answers
27 views

Search by pattern, and copy within the same folder but with a different name

This is the folder structure: /home/user/Pictures/Vacation/Italy/Rome/photo.front.001.jpg Within the folder Rome I have many other photos, but I'm only interested in the ones that have "front" in ...
3
votes
2answers
31 views

Forward results of Find command to javac

I wish to compile the results of a find command where the find command returns the relative filepath of a java file located in subdirectories. E.G., I am in ./ and I want to run javac on a file, ...
1
vote
1answer
46 views

How do I find and list folders with a specific folder name, containing files modified recently?

I have a set of folders that are regularly updated, which I would like to regularly parse through and update to a simple text file list. This list gets used with rsync so I shorten the file names ...
0
votes
3answers
55 views

Find-grep for List of .tex Files?

My document.tex where I want to get the list of files, and grep those files with the term gastric \subimport{}{1.2_protocal_answers.tex} \subimport{}{2_protocol_answers.tex} 1.2_protocal_answers....
1
vote
1answer
36 views

How to find files their names, name of files are in one file?

I know how to find and concatinate pdf file. I did with the follwoing code. pdfunite *.pdf output.pdf But the problem is I have list of file names in one file say filenames.txt and I would like to ...
0
votes
2answers
34 views

How to print lines using find and sed in multiple files?

I've many files in a directories structure. I want to extract some string (namely urls) by using a regexp, from those files. I've tried this : find . -path "*alder/ * / * .html" -print | xargs sed -...
-1
votes
2answers
54 views

delete files from specific folders using shell script

I am using Red Hat Enterprise Linux Server release 5.6 (Tikanga). I wrote one shell script to delete files from specific folders. find /app/psoft/pscfg/appserv/prcs/ABC/LOGS -type f -mtime +45 -...
-4
votes
1answer
27 views

Explanations of {} and -exec in the find command; of the -nr and +4 options to sort

Can some on explain the below command find . -type f -size +50000k -exec ls -l {} \; | grep -v "data/dr" | sort -nr +4 1) why { } is used ? 2) what is the purpose of using +4 is used after -nr? 3) ...
1
vote
2answers
56 views

Bad substitution trying to rename extension [duplicate]

I'm trying to convert all wav and mp3 files to ogg files recursively with find and FFmpeg. I have made the following bash script to do so: #!/usr/bin/env bash # Converts samples to ogg find samples ...
0
votes
2answers
69 views

How to Do this List Comparison with Find?

I do and get a list of files where I would like to delete many duplicate backup files find . -type f -name '._*' I would like to find those files which have a corresponding filename /home/masi/....
1
vote
0answers
27 views

Find recursively files that have a percentage of lines in common

Is possible to do this? I want an output where i have only files that are 50% the same of others or have 20+ lines in commons. I'm trying to isolate commons functions in *.java files. Thank you!
0
votes
1answer
99 views

How to Solve this Read-only file system error?

I do find /media/masi/FAT32/ -type f -name '._*' -delete but I get find: cannot delete '/media/masi/FAT32/._booklet.pdf': Read-only file system I do not know how to work with such situations ...
0
votes
1answer
35 views

Pass filename from find and execute command

I'm trying to write a script which finds certain files and executes a command with the files it finds. Doesn't sound too hard, but I'm having a lot of trouble getting it to work. Basically this is ...
1
vote
1answer
162 views

How to Relink these symlinks after moving the system?

I moved my filesystem and symlinks from Ubuntu 14.04 to 16.04 by using FAT32 memory card, which apparently broke those links; stopped using BitTorrentSync. Differential condition is that those links ...
2
votes
1answer
47 views

Permission denied when using -exec {} ls with find command

When run following command it gives me permission denied message for all the files. find /data/code/ -name "*.jar" -exec {} ls \; find: `/data/code/project/shared/build/thirdparty/log4j-1.2.8/...
2
votes
2answers
154 views

find and remove files bigger than a specific size and type

I want to clean up my server from large log files and backups. I came up with this: find ./ -size +1M | xargs rm But I do not want to include mp3 and mp4. I just want to do this for log and ...
1
vote
1answer
37 views

Search files in a certain period and copy them into another directory

The problem is that I have a directory containing many files with extensions .xml, .txt and .p7m from year 2015 up today. I must create a script that searches into the directory 1 all files created ...
0
votes
1answer
27 views

Is there such a notion as broadening where find searches?

I'm trying to identify redundant installations of the site package matplotlib in my python3.5 environment. A contributor to the library (GitHub issue) is advising that I use python3.5 -m site ...
2
votes
0answers
47 views

find - No such file or directory albeit it exists

I run the following command on a directory: find . -name "*.pyc" -type f -delete however it prints this find: -delete: unlink(./tests/unit/framework/__init__.pyc): No such file or directory for ...
0
votes
1answer
24 views

Performing Prime Key function using 'Sed' in Bash

I am using bash and trying to employ sed command for matching a string and replace it with another between two files. Objective: To replace all strings[sp_*] by matching them from another file ...
2
votes
1answer
66 views

substring removal in find -exec

When using $ find . -name string~ -exec cp {} FOO \; is there a way to use {} in FOO to remove the tilde character as we usually do with bash substrings e.g. : $ echo ${string%substring} I ...
0
votes
0answers
51 views

Does `find` return directories that are not on the file system?

I'm trying to identify where the python site-package matplotlib is installed on my computer. I ran find ./ -name matplotlib at the top most directory (called the root, no?) and was returned the ...
1
vote
1answer
51 views

find X but exclude these?

Original find which works in OS X but not now in Ubuntu 16.04 find $HOME -type f -name "*.tex" -exec grep -l "masi" {} + | vim -R - (simplified version still; you can omit vim part but it just ...
1
vote
3answers
32 views

ln -s $SOURCE/* except - with find?

I want to do a symbolic link from all directories and files in the first node of $SOURCE to $HOME/Destination/. Pseudocode ln -s $SOURCE/* exceptThese $HOME/Destination/ Proposal find $HOME ! -...
2
votes
2answers
65 views

how can I find files based on different names and delete all them in one single line [duplicate]

Finding files based on different names I know how to do. The problem is that I don't know how delete all of them at once. I am using OMVS in z/OS390. To find files searching by different extensions I ...
2
votes
4answers
56 views

How do i find over 200K differently named files and output

We have a SAN with a lot (over 5 million) of files. Because of some freak mistake from a developer script, some files have been deleted and we now have to figure out which files got deleted. Now, I ...
0
votes
1answer
9 views

“find” doesn't list all files under specific directories

I'm attempting to get a list of all files under specific folders, recursively, with the "find" command. find / -path "/usr/sbin/*" -o -path "/usr/bin/*" -o -path "/usr/local/sbin/*"-o -path "/usr/...
1
vote
0answers
41 views

Simple code reading issue [closed]

I'm studiyng Linux on a guide as a beginner, and there's a code example I cannot understand. I let you it below: find . -name "*.tmp" -exec rm {} \; by reading it, up to now I can understand that ...
2
votes
4answers
52 views

Access a file located with find

In many cases after I find a file using the find command I then want to open the file or cat it or maybe print it. How can I operate on the result from find? For example, : find . -name "myfile.txt" ...
2
votes
2answers
73 views

find command, is there a way to get a progress report?

firstly please forgive my lack of knowledge of Unix - that's why I'm here after all. I've created an AppleScript which searches for files on a Mac and have greatly improved the speed by using the ...
2
votes
2answers
61 views

Bash script to count file types in a path (including subfolders)

I would like to get a quick overview over the different file types in a directory (including all its subdirectories) using the file tool, e.g. telling me what file type is the most common one there. ...
1
vote
2answers
121 views

find: meaning of the \? sign as a value of the name parameter

What is the meaning of the ? sign in the following command? find /foo/path -name \?
3
votes
4answers
74 views

find: do nothing, if no files get specified

I want to call use find on some filenames. find $(do_something to find filenames) -print0 | xargs -r0 ls -ld This breaks if $(do_something to find filenames) returns nothing: The find-command ...