All Questions
682 questions
1
vote
6
answers
232
views
Move a lot of folders with spaces in the name
I have a lot of webpages saved in my Download folder and I want to move all html files together with its folder (for every "NAME.html" exists "NAME_files/" folder).
The big ...
0
votes
2
answers
91
views
Adding up sizes of directories using bash is inconsistent
First, I got the total size of folder /my-downloads:
$ du -sh /my-downloads
304G /my-downloads
As you can see, it's 304G.
Then, I wanted to find out the total size of all immediate directories ...
1
vote
1
answer
61
views
Bash - Having trouble with the find command and excluding paths
Short background; I have a script I run to put new TV episodes into my library after conversion and naming. It just locates the matching directory by name. Recently I fsck'd my drives, and it warned ...
0
votes
1
answer
51
views
String replace in wildcard using find command
I want to exclude all C files that have a matching asm file. The assembly files all have _x86_64.S at the end. The C files have identical names, but with .c instead of _x86_64.S at the end. How would ...
4
votes
2
answers
294
views
How to find and list all symlinks in a short form?
I have a large set of directories and files, along with many symlinks that typically point to a directory called "shared" or to a directory or a file underneath the "shared" ...
0
votes
3
answers
83
views
recursively find all directories *primarily* occupied with images
I'm working on a very unorganized archive of a friend spanning many years and with a lot of duplication and compicated structure. I want to split the archive into directories that are primarily ...
4
votes
4
answers
313
views
BASH - Find file with regex - Non-recursively delete number-only filenames in directory
I'm wanting to non-recursively delete all files in a directory where each filename contains only numbers, using only a single line of BASH.
I somehow accidentally ran a shell script with commented out ...
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
1
answer
89
views
Continue a directory tree checksum from a given file
I have:
A checksum.txt file which contains many lines of checksums of single files from a mountpoint in a huge directory, which mounted and then it disconnected, thereby not finishing the checksum....
8
votes
5
answers
2k
views
How to execute a command on all files whose names match a pattern and whose contents match a pattern?
Say I want execute cmd on all *.cpp and *.hpp files that contain the word FOO.
As far as just finding those files goes, I know I can do,
find /path/to/dir -name '*.[hc]pp' -exec grep -l 'FOO' {} +
...
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 ...
1
vote
1
answer
38
views
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....
3
votes
6
answers
222
views
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 ...
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
110
views
Find - xargs, for every line open a new shell and execute a command and wait for user to exit that shell
Following works
Task: List all folders that contain file of iname *AlbumArt* that also contain iname *cover*.jpg, and for each of those folder list all jpg files with size
find . -type f -iname '*...