Skip to main content

All Questions

Tagged with
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
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
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 ...
bfontaine's user avatar
  • 164
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
Arpan Koley's user avatar
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" -...
Oleg's user avatar
  • 39
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 ...
jia103's user avatar
  • 135
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 ...
Gabriel Staples's user avatar
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 ...
Pietru's user avatar
  • 393
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. ...
TomDerks's user avatar
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 ...
kosmosu05's user avatar
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 ...
pbialy's user avatar
  • 123
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 ...
Kvothe's user avatar
  • 453
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. ...
user avatar
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 ...
DEKKER's user avatar
  • 998
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 ...
d-b's user avatar
  • 2,047

15 30 50 per page