All Questions
Tagged with shell-script find
377 questions
0
votes
2
answers
40
views
find script to sort subtree into most recent modification times?
What is the find script to sort a subtree into files with the most recent modification time? Also preserving their path name?
I suspect it has something to do with find, ls, awk and sort. I haven't ...
3
votes
2
answers
106
views
Build find command from arguments in a POSIX compliant shell script
I'd like to know if it's possible to write a POSIX compliant script that builds a find command from its arguments.
The way to do it for Bash (and zsh) is explained in this other SE article but it's ...
0
votes
0
answers
70
views
Pass in argument of directory for find command to ignore in script
When I call the script (via commandline) I'd like to pass in an optional list of directories for the find command to ignore. This is what I have but my output includes data from files in the ...
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 ...
2
votes
2
answers
344
views
find with du -sch and very many files
I have large folder structure and need to get the size of a certain subset. The directories I need to count are defined by having specific subdirectories:
find . \( -iname a -or ... \) -printf "\&...
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
217
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 ...
2
votes
2
answers
245
views
Search and replace composed Unicode characters
I have a deep folder structure on a Debian machine
where the directory names and the filenames
contain some "special" characters (ä,ö,ü).
However, these are not in "ISO-8859-1"
...
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....
1
vote
4
answers
225
views
How to sort and filter images by modification time and view them in nsxiv on FreeBSD
I am using nsxiv to view JPEG and PNG images on FreeBSD. However, I am unable to find a way to sort and filter the images by modification time to view them in nsxiv on FreeBSD. On Linux with GNU ...
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 -...