Using Ubuntu. I have a directory, with some sub directories, which may have some files with names formatted like this: So, they all start with ‘core’. then a process name, then the PID number, which is usually 4 or 5 digits. My Python based tool uses two ‘find’ commands to find them, like this: So, this is essentially calling the
Tag: find
Linux/shell – Remove all (sub)subfolders from a directory except one
I’ve inherited a structure like the below, a result of years of spaghetti code… In reality, this folder is thousands of subfolders large. I only need to keep ./gallery/{number}/full/* (i.e. the full folder and all files within, from each numbered directory within gallery), with everything else no longer required and needs to be deleted. Is it possible to construct a
find and remove all closed files that are not modified in some-time
I’m building a script in linux that will remove files from the disc that aren’t in used currently by the OS. I want to use find command so I can execute rm for all the files that I find that are not open. I tried so far this command without success: I found this command in some website it supposed
Change file names by Perl [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 7 years ago. Improve this question How to change file names from notation like this: SomeCodeFile.extension to C/C++ notation:
bash script – executing find command gives no output
I’m a total noob at bash so this is most likely a syntax error, but I could not find anything that worked for my syntax in my searches. From terminal, running find . -name “*g*” results in However, running this bash script called grepdir.sh from terminal as grepdir.sh . “*g*” results in: meaning that cmd must be empty. But from
How to find newest files with a certain name?
Suppose I have a directory with many files of the same name in subdirectories (for example, comes up when keeping BibTeX files for multiple academic papers). What’s the best way to find the newest version of a file with a given name? I’ve come up with the following command which lists all the files named someFile along with their dates,
I’ve found a way to use find -exec to cp multiple files all in one line like xargs, but I’m not sure exactly how it works
I’ve been working with find -exec and find | xargs for the past few hours exploring and experimenting, and now I’ve found a variation of the command that I haven’t seen anywhere else. For example this find command to get all files in the child subdirectories and copy them to the current directory will all execute on one line like
crontab not working under arch linux
I tried to set up a schedule to remove the old file and folder after several days. I put the following code in a script file and tried to use crontab to run it every day. The find command worked fine. but the crontab seems not execute the script file. I also use crontab for other tasks, i.e. rsync, they
How do I ‘skip’ minified JavaScript files while searching through a tree of js files?
I search a large js tree frequently for certain Tokens. Consider you were looking for all of the ‘.prototype’ tokens in your js files. I would do something like this: Of coarse this produces a boat-load of hits on minified vendor libs. Obscuring the real results I am after. i.e: results like that Ad nauseam. So how can I detect
How to display modified date time with ‘find’ command?
With a find command, I can display directories names with multiple levels. The following command display all directories under /var path with a depth of 2: The result shows: With a stat command, I can find the modified date time: The result is: Is there a way to combine the two commands so that directories will be listed with modified