All Questions
38 questions
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 ...
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....
5
votes
6
answers
1k
views
How to find files that don’t have a suffixed version?
I have a few million .jpg files and I want to generate a .jpg.webp version for each one (foo.jpg -> foo.jpg.webp). For this, I need to find all files ending in .jpg for which there’s no .jpg.webp ...
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
0
votes
1
answer
165
views
How to display the paths to all files that have a size greater than the specified limit
I need to output the paths to all files that have a size greater than the specified limit (declared as a variable).
I've done it using find script:
FILESIZE = "+10M";
find "$1" -...
2
votes
3
answers
2k
views
How to move files into subdirectories segregated by date
I have a large directory of files last modified over the past several years through now. Is there an easy command or commands I can type one-time in an interactive bash shell that can create ...
5
votes
3
answers
7k
views
Find files greater than x kB/MB/GB in size, and also show their size
I'd like a simple command (perhaps using find) which finds all files > some size in bytes, kilobytes, megabytes, or gigabytes, and which prints their size as they are found.
This command, for ...
0
votes
1
answer
98
views
Passing file types to bash function and calling find
I have the following bash function to print between two line numbers, for files watching file types .texi and .org recursively in a particular directory.
I would like to be able to supply the file ...
4
votes
2
answers
2k
views
Parent child directory same name , move files to parent directory
I need a way to search directories for child directories with the same name and then move all files in the child directory to the parent.
Thus from
/recup-dir1/recup-dir1/files to /recup-dir1/files.
...
1
vote
3
answers
4k
views
Getting a list of files by a pattern in a directory and all nested ones, and iterating over a result
In a directory, "my_directory", which has other directories in it, of multiple level of nesting, there're some files that I want to find by pattern and then, one by one, upload them to a ...
2
votes
1
answer
387
views
Rename all files with specific format which are in folder with specific name
In my project I have a lot of test files, which are named *.ts.
They are all in __tests__ folders, but it can be __tests__/test1.ts, __tests__/dir2/test2.ts and so on.
I would like to rename those ...
1
vote
1
answer
582
views
Move directory to other directory preserving directory structure
I want to move a file in ./dir1/subdir1 to /dir2, such that the end result is the existence of a directory /dir2/dir1/subdir1 containing the files previously contained in subdir1.
I want to do this ...
0
votes
2
answers
1k
views
Aligning Columns to Achieve `ls -l` Style Listing with find
I'm trying to achieve the same format of listing that I get from ls -l when using find. Albeit with the full path name at the end rather than the filename. FWIW I'm using find (GNU findutils) 4.5.11.
...
0
votes
2
answers
951
views
Renaming part of name of all files in a directory tree if match
I have a directory tree like this
.
|-- players
| |-- red_alice.plr
| |-- red_bob.plr
|-- resources
| |-- red_cash.rsc
| |-- red_food.rsc
I want to go through all directories and rename any ...
8
votes
4
answers
3k
views
Delete content of file but keep name and hierarchy
I have mirrored a directory structure but I don't care about the content of the files, I just want to keep the name and structure of everything.
How can I replace all files' (not folders) content ...