Skip to content

Tag: find

find and copy command not working in bash

This line works in the terminal, but not in a bash script: cd /home/me/Downloads/Data/$currentYear/$currentMonth/$currentDay/ find . -name ‘*.wav’ -exec cp {} $tempfolder ; I’m trying to copy all the WAVE files from all the sub-directories to a temporary folder Answer So, I solved it. Turns …

find files modified within given time range

Hello to everyone I’m trying to create a script to search files that modified between X:00-X:59. X is given by the user. I’ve tried this: Any solutions? Answer -newermt primary doesn’t accept a time range in any format. To select files modified within let’s say the period A-B, you need…

How to find all symlinks to a file?

This is my hierarchy: l1 and l2 are symlinks to a.txt. I run this code to find all symlinks to a.txt in the /aaaaaaaa: And it obviously doesn’t work, cause I must compare realpath of file with path of a.txt. In what way I should do this? Answer If you have GNU/BSD find just use -samefile primary.

Delete logs that ended with date format

I created the following cli in order to delete the logs with date format that oldest then 500 min date format is: the cli that should removed the logs as we can see the logs still exists where I am wrong? Answer Your regex does not match the files. Change ‘.*.log.[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2,10}$&…

recursively find directories without setgid set

In linux, how do you recursively pull up a list of all directories that do NOT have the setgid bit set? I know you can do to find all the directories that have it set, but it’s not obvious to me how to negate this. Or if another tool is more appropriate for this use case. I’ve got a rather