Skip to content

Tag: find

How to skip multiple directories when doing a find

I’ve written a find function that searches for a string in each file in a given path, while skipping a list of directory names that I don’t want searched. I’ve placed this script in my .bashrc file to be called like so: The find portion works great, and it colorizes the search text so that i…

Exclude list of file extensions from find in bash shell

I want to write a cleanup routine for my make file that removes every thing except the necessary source files in my folder. For example, my folder contains files with the following extensions: .f .f90 .F90 .F03 .o .h .out .dat .txt .hdf .gif. I know I can accomplish this with: Using negation, I can do this: B…

Tar search results in .sh file

I have to tar a list of files, without path, that is a result of a find via sh (for crontab use). In ubuntu’s shell each command works fine but in .sh not. I tried with : And also with But both failed. May someone help? Alternatives ? Additional scenario info: /myfolder/ contains: one1.log one2.log one3…

Combining find command conditions

I am trying to combine 2 find commands to pipe to a grep pattern match. my 3 commands are: get files modified in the last 24 hours: ignore a couple of directories: find pattern in the file’s lines: I have gotten below to work but cant seem to add directory skipping into the mix. get files modified in th…

getting the output of “find” in a CSV

I’ve got a project where I’m trying to collect all the files on a linux system into a CSV to be dumped into a DB. my script has But the problem is that I have filenames %f and directory names %h with commas in them. So then I thought I could just put each item in quotes and that won’t