linux:find
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:find [2020/09/20 12:45] – Wulf Rajek | linux:find [2025/02/11 21:14] (current) – Wulf Rajek | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== find examples ====== | ====== find examples ====== | ||
+ | |||
+ | General note to '' | ||
+ | The following executes program and sends a space separated list of quoted filenames to it. Program may be called multiple times if the amount of arguments exceeds ARG_MAX. | ||
+ | < | ||
+ | |||
+ | The following executes program with one! quoted filename, then executes program again with the next etc. | ||
+ | < | ||
+ | |||
+ | |||
+ | |||
Find and extract all rar files in subfolders into the current folder: | Find and extract all rar files in subfolders into the current folder: | ||
Line 64: | Line 74: | ||
find . -type f -name " | find . -type f -name " | ||
</ | </ | ||
+ | |||
+ | Recursive file renaming extension (e.g. from " | ||
+ | < | ||
+ | find . -type f -name ' | ||
+ | </ | ||
+ | |||
Move files in subdirectories to other directory while retaining directory structure | Move files in subdirectories to other directory while retaining directory structure | ||
Line 79: | Line 95: | ||
delete empty directories: | delete empty directories: | ||
find / | find / | ||
+ | </ | ||
+ | |||
+ | ====== Replace spaces with underscores ====== | ||
+ | Mass replace spaces with underscores | ||
+ | < | ||
+ | for file in *; do mv " | ||
+ | </ | ||
+ | |||
+ | ====== Find largest subdirectories ====== | ||
+ | < | ||
+ | du -hd1 | sort -h | ||
+ | </ | ||
+ | |||
+ | ====== Recursively changing extension ====== | ||
+ | < | ||
+ | find . -type f -name " | ||
+ | </ | ||
+ | |||
+ | ====== Recursively delete empty directories ====== | ||
+ | < | ||
+ | find . -type d -empty -delete | ||
</ | </ |
linux/find.1600602336.txt.gz · Last modified: 2023/05/29 11:53 (external edit)