Skip to main content

All Questions

Tagged with
1 vote
1 answer
72 views

Rename the sub-sub-directories of a directory named _QWE

I can run a command in all directories named _QWE using: find . -name '_QWE' -type d -execdir touch {}/1234.txt \; However, I need to run -execdir rename 's!^\./(\d+ -)\s(\d+\.)!$1!' {} \; in all the ...
Ahmad Ismail's user avatar
  • 2,978
3 votes
2 answers
2k views

find -name -path

I have a some tree. . ├── 1 │   └── a │   └── script.a.sh ├── 2 │   └── a │   └── script.b.sh ... └── a └── script.sh And I need to find script.*.sh. I execute ./a/script.sh: #!/bin/bash #...
xUr's user avatar
  • 245
1 vote
0 answers
29 views

Recursively remove certain folder from entire folder tree [duplicate]

Given a directory projects/ whose subfolders may have a venv/ folder at variable depths projects/foo/src/venv/ # venv/ at depth 2 projects/bar/venv/ # venv/ at depth 1 projects/baz/src/...
Michael Moreno's user avatar
0 votes
1 answer
2k views

find files, exclude directories

I would like to compose a string of command line arguments in a variable, then use those to execute a command. I show a simplified example below. It's is a script called "listfiles." It ...
dougd_in_nc's user avatar
7 votes
3 answers
1k views

Find all directories that contain only hidden files and/or hidden directories

Issue I have been struggling to craft a Bash command that is able to recursively search a directory and then return the paths of every sub-directory (up to a certain max-depth) that contains ...
BitWrecker's user avatar
1 vote
1 answer
3k views

Delete all zip files from a folder recursivley

I am trying to delete all zip files from a folder /mnt/drive1/temp and its subfolders recursivley. I am aware that an incorrect command here could have disastrous consequences so wanted to check I had ...
fightstarr20's user avatar
0 votes
3 answers
85 views

sorting out files to different directories for a main directory

I have numerous files I am trying to move from a main directory in to separate directories which have multiple sub-directories inside. Example file naming conventions 1SA_1BA_1W.out, 2SA_3BA_3W.out, ...
stormctr2's user avatar
2 votes
2 answers
360 views

Loop through folders and count files in TARs

I need to go through folders and count files in TARs with same name. I tried this: find -name example.tar -exec tar -tf {} + | wc -l But it fails: tar: ./rajce/rajce/example.tar: Not found in ...
Rajce's user avatar
  • 23
0 votes
2 answers
1k views

Find files between two times/hours using find

I will write some context for my problem. I have to deal with a process that runs everyday that creates files in three secuential steps: A, B and C. Files from steps A and C are stored in one folder (...
inivyro's user avatar
5 votes
3 answers
5k views

Get the exact size of files retrieved by find output

My shell engine is either Busybox 1.31.0 or bash 3.2 I need to get the size of the files retrieved from find command. I've been trying to find only files, which have been modified more than 60 days ...
aldehc99's user avatar
3 votes
1 answer
865 views

Commands Differences Using Quotations (Find)

I was reading the man page of find and I found myself confused with the following commands. What is the difference between one and its corresponding one. What is the difference between the following ...
joker's user avatar
  • 604
4 votes
2 answers
4k views

Find the longest file name

I have to find the symbolic link which contains the longest folder name in a folder full of symbolic links. So far I have this: find <folder> -type l -printf "%l\n" I was wondering if there's ...
gubi's user avatar
  • 43
8 votes
2 answers
10k views

How to get the exit code of commands started by find?

I am using "find" in a Travis-CI to check a particular file type with a program. (To be exact, it is a shellcheck check.) However, when using find the exit codes of the command(s)/subshells executed ...
rugk's user avatar
  • 3,436
0 votes
1 answer
112 views

Creating a script that organizes drums [closed]

I would like to create a script that looks in a specified directory, takes in a keyword (i.e. 'kick' , 'snare') and copies all related .wav files into a separate directory. I would then like for it ...
bot's user avatar
  • 1
0 votes
0 answers
50 views

'find exec' once with all found names as arguments [duplicate]

Short question is: how to call some command or a script once with all found names as arguments plus some extra arguments? Long question is: Why does this work (prints all file names 1 name per line):...
spiderface's user avatar

15 30 50 per page