Skip to content
Advertisement

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 out, that the cd /home/me/Downloads/Data/$currentYear/$currentMonth/$currentDay/ was not actually changing the directory for the find .

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 two -newermts; one to include files newer than A, the

Linux Command Line – list all directories containing .js files, and copy the directories and their contents to a new folder

Here is the code I already have that finds and lists all directories containing .js files (excluding the node_modules directory). As you can see, listing those directories is no problem. However, rather than list the directories, I would like to copy them (and their contents) to a new folder, preferably all in one line without running any kind of script.

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}$’ for ‘.*.log.[0-9]{4}-[0-9]{2}-[0-9]{2,10}$’ since there’s no third hyphen (nor fourth

BASH: Filter list of files by return value of another command

I have series of directories with (mostly) video files in them, say I create a variable (video_dir) with the directory names (based on other parameters) and use that with find to generate the basic list. I then filter based on another variable (video_type) for file types (because there is sometimes non-video files in the dirs) piping it through egrep. Then

how to search a file only in user profile and root in linux/unix [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question

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

Advertisement