I am writing a bash script that goes over all files in certain directory and: Picks the files with names that match a specified pattern Sorts them by data and time (date and time are part of the filename) Takes X oldest files Performs certain operations on them The pattern used to match the files is passed to the script
Tag: find
Linux Find command- exclude find based on file name
I feel like this is a ridiculously easy question but I cannot find a simple regex answer for this. Basically, I am trying to use find to get a list of all files in my system with some exclusions. One of these exclusions is any file that ends in .Foo.cs, or any file named FooInfo.cs. I have successfully excluded a
Bash Scripting – REGEX to dump a file list
I have 4 files extensions as result of previous works, stored in the $SEARCH array, as follows : I want to issue one file list for each of the 4 above extension patterns, as follows, except for the case with 2 dots and 2 extensions (marked “NO”) : Obviously I spent hours on regex101 w/o success. I also tried to
Use find command with -perm and -maxdepth [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
linux find files with optional character in their name
suppose I have two files: ac and abc. I want to find a regex to match both files. Normally I would expect the following regex to work, but it never does: I have tried escaping or not the questionmark, this never seems to work. Normally in the regex documentations I have found; ? means: previous character repeated 0 or 1
How to configure the find command to run in a Linux shell script?
I am trying to run the following find command in a Linux shell script. When I run the command in the terminal, it successfully finds all the files with the extension .mp4 from the specified folder, and copies them to a temp folder. However, when I run it in my file_mover.sh Code: Output: I think I’m missing syntax somewhere in
Find and replace a word in all the files, which is falling under a searching criteria at Unix
I want to replace a word in all the files inside all the sub directories, which satisfy some criteria. Below is the elaborated situation. I have to replace all the Word having case insensitive word like {classy, CLASSY, cLassy ,..} to word “Vintage”. Also I only need to replace it where it have a case insensitive word “insert” or “INSERT”.
Find subdirectory and remove files not containing a specific string LINUX
Given a main path ./class and within class are subdirectories student1,student2,student3…student100. within these subdirectories are other sub-directories history,geography,Math. Each of these subdirectories have hundreds of files in them. I want to KEEP all files that have a string pass in Math ONLY without affecting files in other subjects. So far I can cd to Math and do this: find .
Find and scp in one command
I need to scp all txt files in /home/data directory and its subdirectories. The command seemed to work but on the destination server instead of a folder there was a file named testdir and it seemed to have the size of the last txt file that was transfered. Am I missing something in the command? Answer Rsync may be more
Count of files between 2 size in Linux
Hi I want to find count of file between 2 size (for example 1k and 2k) in linux, I found that the code return the count of exact size in a directory and it work fine: could anyone help me how I do find between 2 size? And is it possible that I find the count of Hiden file via