All Questions
133 questions
2
votes
2
answers
342
views
commands execution based on file size fails with no apparent issues
I was working on an array job for a small pipeline, and I happened to need a way to execute a specific command based on file size. I found this post and similar which describe how to do it. At the ...
0
votes
2
answers
89
views
How to find files with find tool in system path ($PATH)? Or alternatively, How to specify starting-point directory for find as an expression?
For example, I want to find all symlinks that reference to particular binary in all directories that belong to system $PATH.
This can be successfully achieved with manual specification of all ...
0
votes
1
answer
218
views
How to exclude multiple directories from chown -R?
I am writing a bash alias to fix permissions that keep getting messed up on my Synology NAS while running Docker. I just need to chown & chmod everything in the /volume1/docker directory except ...
0
votes
1
answer
60
views
find with execdir, pipe redirection evaluated too early (quote issue?)
I use multiple GitHub accounts at work, so I need to modify the remote url to add my work account. I have figured out the recursive find -execdir, and how to get/sed/set the remote url, but I cannot ...
1
vote
0
answers
24
views
find subdirectories from different mount points without symlinks that have the same name as the subdirectory [duplicate]
I struggle to find a working find command, I hope someone has an idea. Imagine the following structure, where path and path{0..1} exist and they are each mounted from a network storage device:
dir: /...
1
vote
3
answers
525
views
Build find command from arguments
I often need to find a file, but I'm not sure what the name is, something like this:
$ find -iname '*foo*' -o -iname '*bar*' -o -iname '*blah*'
This is a little tedious. I'd like to create an alias ...
0
votes
1
answer
120
views
Pipe sql query to find command
OS: RockyLinux 8.5
This command works wonderfully:
sqlite3 files.db "select file from A;" | rsync -R -av --files-from=/dev/stdin /SOURCE /DESTINATION/Out
result without pipe:
sqlite3 files....
3
votes
2
answers
1k
views
I want to find lines where a specific word appears in a file along with line number and take the line numbers in an array .How to do that in bash?
This returns line numbers but they are in a string:
grep -n -F -w $word $file | cut -d : -f 1
1
vote
2
answers
265
views
Execute on all files without corresponding extension
How can I find and execute a program when the said file does not have a corresponding file?
Example files:
/file1.c
/file1.h
/file2.c
/file3.c
/file3.hpp
/file4.c/unrelated.txt
find / -type f -...
1
vote
2
answers
270
views
Getting an array of files built from include array and exclude array containing globs
I am wanting to do the following:
Define an array of globs that specify a base collection of files to include in a process.
Define an array of globs that specify files to exclude from that process. ...
0
votes
1
answer
80
views
Can find reliably call itself from -exec without breaking the semantics of the two instances?
Following http://superuser.com/questions/1780479 and http://superuser.com/questions/1777606, we issue the following script to compare times of the same–full-path symlinks under directories $1 and $2:
#...
2
votes
4
answers
5k
views
find "paths must precede expression" when substituting command results
I am trying to run find to exclude a list of directories that I have in a file. This file is used by a different command as well so I am stuck with the format of the file, which is each line contains ...
0
votes
1
answer
153
views
Find files (ignoring extension) that may contain spaces, based on a supplied text file containing this list
With my limited knowledge of Linux tools, I hit a wall.
Because my list of files contains spaces (space character), the "find" command fails to find any hits, but does not produce any errors....
0
votes
2
answers
198
views
A quicker way to run a script on several files?
I have the below bash script that I created with my yet very poor bash knowledge to batch convert JPG/PNG files to JPEG XL, the script so far works fine for my needs with no problems.
The only thing I ...
4
votes
2
answers
478
views
Use Find to list files and include counter value in output
For performance reasons, I want to use find to list a large number of files, but also include a counter on each line. The following is what I have so far:
local root_dir="."
local ...