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

learn more… | top users | synonyms

3
votes
1answer
377 views

Omitting extension with find?

I need to create thumbnails from multiple .png files and would like to do this using ImageMagicks convert utility. To recursively find all files that are not thumbnails themselves, I am using the ...
3
votes
5answers
3k views

Execute on the basename of a find command

Suppose I have a directory structure as follows test test/a test/b Now I want to execute a command, such that in the . folder I can execute a command on the basename of the files a and b. So ...
2
votes
3answers
53 views

Find files that have a confirmed duplicate in same directory recursively

Say I have the following directory structure: root |-- dirA |-- file.jpg |-- file-001.jpg <-- dup |-- file2.jpg |-- file3.jpg |-- dirB |-- fileA.jpg |-- ...
2
votes
2answers
1k views

How to search and replace strings matching a replacement list for multiple files

I have a file, say map.txt, containing a list of search strings and corresponding replacements: search -> replacement bigBone -> bb fishMarket -> fm dogCollar -> dc ... I need to ...
2
votes
1answer
272 views

How to find files that contain newline in filename?

I am trying to find files that have a newline in the filename. But I can't figure out what pattern to use. The following works, but is not very useful if I want to use it in indented code. find . ...
2
votes
3answers
130 views

Why are POSIX Find Parameters Different from Other Program styles?

Why is a parameter in the POSIX find command added with a single hyphen for multi-character parameter names, while most other programs use single hyphen to indicate multiple single-character flags, ...
2
votes
2answers
499 views

Use a parameter in a command argument

I run a find command to search files with a name containing perl: find /tmp -name '*perl*' /tmp/perl.pl /tmp/run-perl-stage.pl But when I set the perl name in a variable PARAMETER and run the find ...
2
votes
2answers
222 views

Select greatest numbered filename

Simple requirement but can't find anything online which can achieve it. I have a list of dated files as below... filename_20120101.dat filename_20120102.dat filename_20120103.dat I ...
2
votes
2answers
507 views

find all cpp files and list only those files with names that match a pattern (regex) does not work

I have a whole repository of files and I am trying to get a list of files that match a certain criteria. For example, let us say that I want to take all the files that have the string foo1 and ...
2
votes
3answers
514 views

Which is a better way to search- find with regex or find with grep?

Of these two ways of searching a file recursively in all the subdirectories, which is faster / better ? find . -regex ".*/.*abc.*" or find . | grep ".*abc.*"
2
votes
2answers
752 views

Remove 50GB oldest files in busybox when used capacity reaches 95%

Ok i have requested a code here but initial i didn't ask to make it busybox compatible. My bad. I'm new to linux and coding. The code needs to do the following: Delete 50GB of oldest data (dir ...
2
votes
4answers
10k views

How to find the total number of occurrences of text and files with find command

I am trying to run the find command to find the total number of occurrences of a particular text string and also the number of files which has this text string. What I have right now is this command. ...
2
votes
4answers
1k views

Open file found with 'find' command

This is probably an easy one, but I can't figure it out and it's pretty much not searchable. In a folder hierarchy I have exactly one file of type xyz. I want to find that file and open it with a ...
1
vote
2answers
416 views

Using exec in find over ssh from shell script

So, I am attempting to execute the following from within a shell script; ssh -q $CUR_HOST "cd $LOGS_DIR; echo cd $LOGS_DIR; find . -name *.log -mmin +1440 -exec gzip {} \; exit" When this runs, it ...
1
vote
2answers
4k views

How can I find files and then use xargs to move them?

I want to find some files and then move them. I can find the file with: $ find /tmp/ -ctime -1 -name x* I tried to move them to my ~/play directory with: $ find /tmp/ -ctime -1 -name x* | xargs ...
1
vote
2answers
1k views

Find and move directories based on file type and date

I have a directory "New Movies" containing 200+ subdirectories "Movie Name (year)". The subdirectories "Movie Name (year)" contains a single video file (avi/mkv) and several related jpg/xml files. I ...
1
vote
1answer
422 views

Speeding a find rm command with test through parallelization

I want to recursively delete all files in directories and subdirectories with number of lines less than 10, and am currently using the following command find . -type f -name "*.txt" | while read; do ...
1
vote
4answers
200 views

Syntax error in a bash script that calls find

Where is the error in this script please: #!/bin/bash rep="git" files=`find' ${rep} '-type f` for f in ${files} do echo $f done When i run find git -type f alone in the shell, it works!
1
vote
3answers
990 views

Use mogrify to resize large files while ignoring small ones

I'm running the following command: mogrify -resize '400x400>' *.png Notice the ">". Supposedly it will ignore smaller files, but although it doesn't resize them, it edits them (modification date ...
1
vote
1answer
333 views

Error creating an alias for the find command [duplicate]

Possible Duplicate: How to pass parameter to alias? I am trying to shorten the find command, but getting an error: $ alias f='find . -name $1 -print' $ f JobConf.java find: paths must ...
0
votes
1answer
120 views

Error trying to call find from perl

use warnings; use File::Find; my $srceDir = "//mnt/Share_Drive/Verizon PM&T/Capture Files/"; opendir(DIR, $srceDir) or die "Can't open $srceDir: $!"; my @files = (find -type f -newermt "12 Feb ...