find

What are the file size options for "find . -size" command?

What are the file size options for "find . -size" command? I found out that to look for file size in bytes, I use ‘c’. So I can look for file size with 1000 bytes by using: find . -size 1000c But what about different kind of size such as Mb, Gb or even bits? …

Total answers: 3

How to find files with find tool in system path ($PATH)? Or alternatively, How to specify starting-point directory for find as an expression?

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 directories: …

Total answers: 2

Moving and organizing files with find

Moving and organizing files with find I have a folder on a Debian GNU/Linux 12 (bookworm) x86_64 Server used as a NAS/Homelab server with a lot of files from a surveillance camera. MDAlarm_20240301-091804.jpg … MDAlarm_20240316-153813.jpg MDAlarm_20240327-183713.jpg If I try to move the files with (eg) mv snap/*.jpg /path/to/dest/2024/03 I get -bash: /usr/bin/mv: Argument list too …

Total answers: 1

Using find with regular expression

Using find with regular expression I try to understand how to use the find command with regular expressions (macOS 14.4.1, Zsh 5.9). I have a directory with files such as note-red.png, note-yellow.png, (and other colors), folder-red.png, folder-yellow.png, (and other colors), but the following commands don’t show any results when executed in that folder. What I’m …

Total answers: 1

Find files that are sorted before a given file

Find files that are sorted before a given file I have a directory with a number of files. Example: aaa.txt bbb.txt ccc.txt ddd.txt Given an arbitrary string (not necessarily the name of one of the files), I want to find all the files that are sorted before that string (in a normal alphabetical sort). Example: …

Total answers: 6

Is there any way to get `find` not to quote the result of -printf

Is there any way to get `find` not to quote the result of -printf I want to use the find command with -printf ‘%h’ to print the leading directories, separated by the nul character. Since I am using , I don’t need, and don’t want find to quote the results, as described in the "UNUSUAL …

Total answers: 1

linux find and rename items with backslash not working as expected

linux find and rename items with backslash not working as expected I have tried a couple of approaches to find and rename some files that hold a backslash (mind you these files generated from a web app do not have the quoets) in a directory. I’ve tried with find and substitutions but they seem to …

Total answers: 2

Find all the folders that are concealed using 'chflags'

Find all the folders that are concealed using 'chflags' I have concealed some folders on my laptop using chflags: chflags hidden hide-me And I don’t remember where exaclty these folders are located. How is it possible to find all of them? (Probably by using find and/or grep.) Asked By: jsx97 || Source Something like that: …

Total answers: 1

Why doesn't the given command mask other lines?

Why doesn't the given command mask other lines? Command: sudo find / -name miniedit.py -print | grep -i "miniedit" | tail -1 Output: find: ‘/proc/10031/task/10031/net’: Invalid argument find: ‘/proc/10031/net’: Invalid argument find: ‘/run/user/1000/gvfs’: Permission denied find: ‘/run/user/1000/doc’: Permission denied /usr/share/doc/mininet/examples/miniedit.py Expected output: /usr/share/doc/mininet/examples/miniedit.py What am I doing wrong? Asked By: kesarling He-Him || Source You …

Total answers: 1

find with execdir, pipe redirection evaluated too early (quote issue?)

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 combine them. I tested the find command …

Total answers: 1

Add files from "bash find" to 7z archive

Add files from "bash find" to 7z archive I did quite a bit of searching before asking this! (Even so I’m expecting to have a duplicate pointed out). So I collect a bunch of files, e.g.: find . -name "2020-*" … is there some way to "pipe" all these files into a .7z archive? (NB …

Total answers: 1

List all files in a directory, recursively, sorted by modification date

List all files in a directory, recursively, sorted by modification date The main answer of Sort the files in the directory recursively based on last modified date gives a method to list all files in a directory, recursively, sorted by modification date: find -printf "%TY-%Tm-%Td %TT %pn" | sort -n However it doesn’t list only …

Total answers: 1

find -prune: why does -print0 affect search results?

find -prune: why does -print0 affect search results? Scenario: $ tree . . ├── x1.txt ├── x2.txt └── x3.txt 0 directories, 3 files $ find . -name "x1.txt" -prune -o -name "*.txt" ./x1.txt ./x2.txt ./x3.txt $ find . -name "x1.txt" -prune -o -name "*.txt" -print0 ./x2.txt./x3.txt Here we see that -print0 does affect search results. …

Total answers: 1

ffmpeg inside while loop with find unintentionally alters iteration variable

ffmpeg inside while loop with find unintentionally alters iteration variable Can someone please explain to me what is happening here? This is what I have reduced my situation down to: # make 20 test gifs out of the same source file. for i in {1..20}; do cp -p ../some-random-source-file.gif "${i}.gif"; done # grab, then process …

Total answers: 1