Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [find]

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

0
votes
2answers
13 views

ldd shows no location after arrow; library does not exist on system

I want to create a chroot environment that has access to hand-picked programs but is completely isolated from the rest of the system. I created three folders in this chroot folder: bin, lib, lib64. I ...
1
vote
1answer
13 views

AIX Unix - How to Find and Remove files created between date period, with starting and ending characters?

I'm using IBM AIX Unix and it's limited with command option. I want to implement below filter criteria using find and mtime (which works) option. I would like to remove the files listed with below ...
0
votes
1answer
41 views

How to use parameter expansion with find -exec {}? [duplicate]

I want to incorporate something like: for f in */*; do mv "$f" "${f%/*}/foo.${f##*.}"; done Into my find x -exec y {} \;-style workflow. The for loop construct & "$f" variable will ...
0
votes
3answers
61 views

Recursively rename all the files without changing their extensions?

How to recursively rename all the files in several layers of subdirectories without changing their extensions? Below's a toned down version (to save room) of what I've got. For argument's sake, I ...
2
votes
2answers
30 views

trying to Rename multiple file names within all directories of a project

ive recently been trying to change the names around in my project and have been having some trouble getting the task done properly. my problem is when I try to use find . -type f -print0 | xargs -0 ...
1
vote
1answer
21 views

How does find -execdir <command> + work?

I understand that find -tests -execdir <command> '{}' ';' runs command for every matching file against the test(s) specified. The command, when using -execdir, is executed in the same parent ...
0
votes
0answers
38 views

Ubuntu 14.04.2 LTS: 'find' not found in PATH or not executable

I am trying to install some graphics libraries with the following command: sudo apt install jpegoptim optipng It however fails to run with stating the following: Reading package lists... Done ...
1
vote
1answer
53 views

find command for file size [on hold]

I need to get details on file size in the following find command. I must be putting the -size option in the wrong place or else I should not be using that to get the file size's. find CDR* -type f ...
0
votes
2answers
25 views

Is there a way to move my unused files and mirror their directories

I want to move my older files in another directory with a script like this find /sourcedirectory -maxdepth 1 -atime +700 -type f -exec mv "{}" /destination/directory/ \; That works well, but it´s ...
0
votes
2answers
22 views

find specific files and copy them to a directory in linux

abc-1.0.zip kncb-1.0.zip jenk-1.1.zip I want to find all the above files dynamically and copy them to a directory except jenk-1.1.zip. I have tried the below command but it also copies file(jenk*....
1
vote
4answers
48 views

Find and remove audio files which has less than 3 minutes of play duration

Is there a way to find and delete all the audio files recursively (MP3 files) which have less than 3 minutes play duration time? Consider the situation that I have mixture of multiple format files (e....
0
votes
1answer
41 views

how to move a file after identifying it with ls | egrep , or “egrep” vs “find”

I need to move all images with a specific filename string to a specific directory. This is an example filename facility_92+SOURCE1+SOURCE1.0 After the 'facility_' there can be 1 to 5 digits. The ...
1
vote
1answer
32 views

'find' -perm example in doc

I was reading the official documentation of find online here. And I came across the following part (and I'm bolding the bolded part): ‘-perm -444 -perm /222 ! -perm /111’ Match files that are ...
0
votes
1answer
54 views

How can I add find exec command into bashrc?

find . -name "*.mov" -exec bash -c 'ffmpeg -i "{}" -c:v libx264 -crf 20 -pix_fmt yuv420p "${0/.mov}.mp4"' {} \; Above command works perfectly when I run it manually but I could not put it within a ...
4
votes
1answer
511 views

find VS GNU find

Consider some common *nix systems (say Debian, Ubuntu, Fedora, CentOS, Arch and Kali). I use Linux since 2014 but always used find. I don't recall personally using GNU find, but from one example I've ...
1
vote
2answers
73 views

Find all directories with exactly two subdirectories [closed]

The command find ~ -maxdepth 2 -mindepth 2 doesnt work is there any other solution? Hm okay i got the solution: find ~ -maxdepth 1 -links 4 -type d Ty for those who tried to solve it
0
votes
1answer
41 views

find: failed to restore initial working directory: Permission denied

I am trying to find some files on a path /local/java_apps/ and then delete them using a shell script and generate a log file in the /home/jboss The code is as follows : STAMP=$(date +"%m%d%Y%H%M%S") ...
3
votes
0answers
48 views

find and symbolic link

I was skimming over the documentation of find to better utilize the command usage. I was reading the part that says GNU find will handle symbolic links in one of two ways; firstly, it can ...
0
votes
2answers
30 views

How to use sed on all matching files?

I am trying to run sed on the output from find | grep \.ext$ However, sed requires input file and output file. How can I save the output line to a variable, or pass it to sed?
1
vote
1answer
18 views

Linux find exec - output to a different directory

I'm trying to come up with a short script to edit some csv files. First, I need to replace delimiters, then change encoding to UTF-16. I would like to do this in two steps, saving the results in two ...
0
votes
0answers
18 views

The find command doesn't work properlly with 1M size [duplicate]

The find command seems not to work with 1M as size properly. I did the following tests: sudo find /etc -type f -size +200k -size -1M | wc l returns 0 sudo find /etc -type f -size +200k -size -...
0
votes
0answers
22 views

Getting unique file names by specific paths only

I have a command where I get the count of all file names that begin with 2010 find folder_name/ -path '*/*/*/*/2010*' This works fine and I get valid results. However, say for instance I have this ...
1
vote
1answer
28 views

Find files missing from a folder/subfolder

I have a backup system based on rsync --link-dest. I'm trying to optimize disk usage a bit more. Once in a while, I delete large files in the source folder. What'd be an easy way to automatically ...
0
votes
0answers
29 views

grep: conflicting matchers specified

I'm using find with xargs and grep to find text which we need to translate in our application. find . -name \*.vue -not -path "./vendor/*" -not -path "./node_modules/*" -not -path "./public/*" -not -...
2
votes
2answers
40 views

Error in deleting files or directories older than 1 day

I am able to delete files or directories older than 1 day using below command find /u01/Release/* -mtime +1 -exec rm -r {} \; but why I am getting error in the output of this command: ls -lrt ...
0
votes
1answer
70 views

how to use find + xargs to make symlinks to selected files while keeping relative directory tree (uses gnu cp -s)

I'm trying to replicate select files from a directory structure as symlinks in a duplicate directory, eg from a directory structure such as this: ../1/a/data1.txt ../1/a/file1.txt ../1/a/b/file2.txt ...
2
votes
2answers
100 views

how to increase the file extension numerically by one

under the following current folder, we have the example of files lok.log.1 df.log.6 weq.log.90 vr.log.11 vs.aw.frsd.log.3 we want to increase the files extension by 1 so the expected output will be ...
0
votes
1answer
42 views

Using 'find' then searching each line for two values in bash script

Hello all I have a slew of files I search through with 'find' recursively then once all those file types are found I want to remove all records not matching this string on each line, in this order: ...
0
votes
1answer
29 views

Find files that contain filler (0x00)

My qbitorrent was set to preallocate files. After a crash it lost a lot of torrents many of which were incomplete. (I purged it afterward, using deluge now) I have a directory containing 1000s of ...
0
votes
0answers
24 views

Why find removes dirs but also shows an error message? [duplicate]

I'm recursively removing directories named __pycache__ with the following command: find . -type d -name "__pycache__" -exec rm -r {} \; It removes all __pycache__ dirs but also shows the following ...
7
votes
2answers
136 views

“find” exclude by fstype strange behavior

I try to have "find" command exclude "/proc" filesystem. I would prefer a portable solution to be able to use it on non GNU based hosts (oldest AIX for instance, where "find" do not have the "-path" ...
1
vote
2answers
24 views

How do I update this recursive directory file search for input and name outputs to handle the below case

I am updating a script that recursively goes through a directory and ocrs the pdf and updates the pdf. In its simple version, it works. ocrmypdf -l vie --deskew --clean --force-ocr --sidecar ...
0
votes
1answer
31 views

How to find files dynamically and copy them to a directory in linux

Trying to find these files and copy them to a directory (test_dir); abc-1.0.zip kncb-1.0.zip jenk-1.1.zip I would like to find all these files dynamically and copy them to a directory. I have tried ...
0
votes
0answers
30 views

Scripted “find & rsync” without parent folder

I have written a small "find & rsync"-script to copy photos and videos from the last month & different folders, to a new folder, with three sub-folders. The script looks like this: #!/bin/...
1
vote
2answers
68 views

Find a list of files that contains a set of consecutive lines defined in another file

I have a Reference file that contains a b c d I have to check all files in a subfolder recursively that contains all the lines of Reference file consecutively and delete those files. For example, ...
0
votes
1answer
25 views

'Find' output as the range of 'for' in Bash is doing in batch mode

I did a loop process using Bash for command, on Linux mint, with the input range is from previous process comes from find, but it'd apparently and clearly did it in batch process relative to terminal ...
1
vote
1answer
40 views

find command of nobody runs on every fresh boot in the morning - debian stretch

Folks, find executed by nobody runs automatically on every fresh boot (in the morning when I boot the system). I guess it is to do with updatedb. How can I confirm my assumption and stop this from ...
0
votes
2answers
22 views

Find + paste + find: do multiple queries to each file

I am trying to get for each file in a directory, a row with at least, the following fields (the order doesn't matter, although that one is the preferable): - Image resolution, in case it is an image....
1
vote
1answer
31 views

find - exec to remove directories with a dollar [duplicate]

In maven local repository directories with dollar name - unresolved properties? I have outlined how I ended up with a few dozen directories that have a dollar sign in their filename. I tried to get ...
-1
votes
0answers
52 views

Using variable in regex option in find

I have exported a variable from a configuration file to a bash shellscript with the variable name $FILTER_REGEX. I want to use it in the following command. This was my attempt. Nothing is in ...
0
votes
4answers
56 views

Exclude all subdirectories from find

I want to look into a folder for some files but I do not want to look into any subdirectories. I do not want to exclude a directory but All! I have tried this from find "$dir" -name '*.out' -type d ...
0
votes
1answer
41 views

Removing files containing, only, one row? [duplicate]

I have large number of csv files saved within a folder. I would like to, only, delete the csv files that contains one row, how can I do that?
1
vote
1answer
53 views

Is “find /var/log -type f -delete” safe on Debian 9?

I never view or care about files in /var/log/ and want to avoid logrotate wasting my system resources (CPU, RAM, I/O, etc.). Are any regular files in /var/log/ necessary for some core Debian program (...
0
votes
1answer
32 views

z flag for head command in centos 7 [duplicate]

I was reading this answer by @dessert: https://askubuntu.com/a/990771/853133 about how to delete old backup folders from directory using cron in Ubuntu. The command given was: find /BACKUPDIR/ -...
0
votes
1answer
32 views

Incompatibility between -prune and -delete in find command?

The manpage for find says: -prune True; if the file is a directory, do not descend into it. If -depth is given, false; no effect. Because -delete implies -depth, you cannot ...
0
votes
2answers
32 views

Equivalent to GNU find -printf flag in other find implementations

Specifically, in mkinitcpio the command find -mindepth 1 -printf '%P\0' is used, what would be a way to recreate a command with identical output without the -printf flag. https://git.archlinux.org/...
0
votes
2answers
45 views

make find search in alphabetical order

I am currently using a short find command in order to search a number of directories (and sub-directories) for files ending in "tex" and then catting them into one coherent text. The command that I ...
0
votes
2answers
26 views

Find with absolute path inside a bashscript | xargs basename

I have to find recursively inside a bash script. Since I can invoke the bash script from anywhere, I am forced to use the absolute path. Sometimes the absolute path can get very long, and the output ...
0
votes
2answers
37 views

How do you find the path of a directory that contains one file but don't contain another file?

Right now my approach is to: find directories containing a.txt find -type f -iname "a.txt" | sed -r 's|/[^/]+$||' > a_paths.txt find directories containing b.txt find -type f -iname b.txt | ...
0
votes
5answers
85 views

List Files which don't contain a particular string at a particular line

I am trying to find all files with extension .md find . -type f -name "*.md" Then I want to filter out those files whose 2nd line (line number = 2) doesn't contain this exact string beginning and ...