Skip to main content

All Questions

Tagged with
1 vote
1 answer
253 views

find and rename base directory and files under each basedir, add a prefix

I would like to recursively rename all matching directories and files under a path with a prefix that depend from the current directory. . ├── G1_BIN_REFINEMENT │   └── marker_genes │   └── ...
user1967473's user avatar
1 vote
1 answer
750 views

How to tell which files are new or have been modified between calls of a script

I want to call a shell script regularly, and in it I need to process the files present in a directory tree that are new or that have been modified since the previous call of the script. My 1st thought ...
dargaud's user avatar
  • 220
2 votes
1 answer
888 views

List only bottom level directories using find

So, let's say I use find to search a directory for folders. find "/home/user/Documents" -type d -print While this does list all the directories in said location, I only want to get the ...
Eduardo Perez's user avatar
1 vote
2 answers
516 views

Cygwin find returns "missing argument to `-exec'"

I have backups script that removes backups older than x days. On Linux machine this is working well: find /backups/dummy-prod-db -name "*_D_dummy-prod-db*" -type f -mtime +7 -exec rm -v {} \;...
Kamil's user avatar
  • 2,666
11 votes
1 answer
647 views

In bash, how to find all copies of a given file in particular directories?

Let's say we have a file /a_long_path_1/foo.doc of size, say, 12345 bytes, and we would like to find all copies of this file in directories /a_long_path_2 and /a_long_path_3 including all their ...
user avatar
2 votes
1 answer
2k views

Bash find using regex fails with digit matching

I'm using find (GNU findutils) 4.7.0 with GNU bash, version 5.0.17. touch hello.32.world.txt find . # works, output is: ./hello.32.world.txt find . -regextype posix-extended -regex '.*hello\.32\.world\...
Andrew Parks's user avatar
0 votes
1 answer
449 views

Move and rename files based on their parent folders

I'm trying to write a Bash function that will find files in a given directory tree and move them to the current folder while renaming them based on their parent folder, but I'm still stuck on the ...
Hashim Aziz's user avatar
  • 13.1k
0 votes
1 answer
474 views

How to do a recursive filename `find` from the shell using a glob pattern with "set braces"

From the shell, I'd like to recursively search a directory for a given glob pattern. But I want to use set-braces-syntax in my pattern: find ~/path/to/dir -name '*.{h,m}' Here I'd like to recursively ...
Todd Ditchendorf's user avatar
1 vote
0 answers
2k views

Can I use regex in find path?

env = bash, centos7 My goal is to delete jenkins workspace cache files under specific path, except for today's. Successful command : cd /jenkins/jenkins/workspace/CMSvc_Build/caches/modules-2/files-2....
Lunartist's user avatar
  • 159
0 votes
0 answers
163 views

Calling exiftool on a huge number of recovered images from photorec

I am trying to recover images of the last 20 years from a friend. She moved all recent files to trash, then emptied the trash. Those images were lying on the system partition, so photorec found a huge ...
dwn's user avatar
  • 101
0 votes
1 answer
4k views

List all sub-directories with a specific pattern in bash and execute a command

I have a directory like this: . ./foo/.bar/bar/file.jpg ./foo/.bar/xyw/dummy.fil ./foo3/.bar/file.jpg ./foo3/.bar/bar/file.jpg ./fo/bar/file.jpg I'm trying to list all subdirectories that contain the ...
amsou's user avatar
  • 3
0 votes
1 answer
276 views

search over all drives in git bash crashes - "failed to read file names from file system at or below '/': No such file or directory"

I am using the git-bash for windows (what is internal msys2). I needed to search over all of my harddrives. When I try to run find / -type d (and my search patterns), the search runs over the system ...
Radon8472's user avatar
  • 801
1 vote
1 answer
352 views

regex in find doesn't accept the or operator in group

I'm trying to delete all files and directories in a parent directory, with the exclusion of some directories and their content. For this I use find in a bash script on MacOS. It works if I exclude ...
Philipp's user avatar
  • 13
0 votes
2 answers
704 views

How to delete any files that have not been used (access, change or modify) in X years

i run this command find BAR -type f -mtime +1095 # older than 3 years and find this file: BAR/foo.pdf So i run this: stat BAR/foo.pdf Access: 2020-01-03 01:32:05.584393000 -0500 Modification: 2017-...
acgbox's user avatar
  • 785
0 votes
1 answer
413 views

Find the most recent file of a type in terminal and then open it (mac os)

I found part of this question in 2 other posted questions, but I cant seem to get the last step working which is just "opening" the file: How do I get files found by command-line 'find&#...
Mix Lab Tech's user avatar

15 30 50 per page
1
2 3 4 5
17