Skip to main content

All Questions

Tagged with
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 ...
Antonio's user avatar
  • 193
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 ...
Logan Lee's user avatar
  • 249
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 ...
Naf's user avatar
  • 11
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 ...
Ryan Maguire's user avatar
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" ...
codeforester's user avatar
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 ...
akostadinov's user avatar
  • 1,109
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 ...
Stev's user avatar
  • 61
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 ...
Matteo's user avatar
  • 199
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....
Sir Muffington's user avatar
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' {} + ...
Enlico's user avatar
  • 2,179
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 ...
Anton Samokat's user avatar
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....
JoSSte's user avatar
  • 215
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 ...
Lii's user avatar
  • 187
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 ...
DasKraut's user avatar
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 '*...
Porcupine's user avatar
  • 2,146

15 30 50 per page
1
2 3 4 5
46