Questions tagged [find]

find is a command line utility to search for files in a directory hierarchy

3
votes
1answer
124 views

find not working correctly in cron

We have a regular job on a server that creates some files in /tmp and doesn't delete them after it is done. For reasons I don't want to get into, we can't modify the job to delete the files. So I was ...
3
votes
1answer
317 views

Find a keystore file containing a particular SHA-1

I have the SHA-1 of a file. I have a keystore file which contains this SHA-1. But I don't know where this keystore file is on my system. Is there any way to find the keystore file that contains the ...
3
votes
1answer
59 views

Is there a version of the 'find' command that saves its state?

If a find is searching a large disc, and is aborted for some reason, I'd like to be able to start it again, from where it left off. Is there a version of 'find' that does this? The problem is that, ...
2
votes
1answer
69 views

How to zip many n-th level subdirectories, without their top (parent) dir?

in such a filesystem structure: root/ | container1/ | | | subdir2/ | | | subdir3/ | | | ...
2
votes
1answer
403 views

Linux find command doesn't seem to work

Can someone please help me understand why my find command doesn't report the lib64 result like it does with the ls command (note these commands are called in makefile on Debian) LIBXML2 = $(shell ...
1
vote
1answer
32 views

Attempting to only copy files that have changed within the last day while maintaining folder structure

I'm attempting to find and copy files that have been modified within the last day. While doing that I'm trying maintain folder structures under dir1. There are many subdirectories under dir1 and data ...
1
vote
1answer
41 views

Zipping all sub directories

Trying to zip a backup directories inside a parent directory data/ which looks like this data |- 2019-04-01 |- data.gz |- data2.gz |- 2019-04-09 |- data.gz |- data2.gz I would like ...
1
vote
1answer
133 views

Lockdown find command in sudoers with regex

I want to allow a service user to search for files via a dialog script, but lock down the find command via sudoers, so only one command including a regex is allowed. This exact command should be ...
1
vote
1answer
29 views

How to use 'find' and 'cpio' to exclude parent directories

I want to copy over all html files in a nested directory but I want to prevent the parent folders above it from being generated as well. That is if my source path is /project/ng1/src/templates/**, ...
1
vote
1answer
49 views

move files of certain type and rename ones with the same name

Here is what I am trying to achieve: I converted pst files using readpst library into separate .eml files. After converting each of the pst files, I got a directory with multiple sub-directories ...
1
vote
1answer
40 views

find files with particular attributes, rename them to their directory name, copy them elsewhere

It won't look like it, but I've spent 3+ hours trying to figure this out... I am trying to identify files in all subdirectories of a parent directory with particular attributes (name and size) then ...
1
vote
1answer
39 views

Archive directories with subdirectories not modified in x days

I have been looking for a way to archive our fileserver for some time now but have not found a working solution. The objective is to search through a directory and it's subdirectories for files not ...
1
vote
1answer
64 views

How do I determine all the damaged program image files without running them one by one?

I have a machine where running various commands results in an Input/output error. This is the result of a hardware fault. I am trying to determine what files remain undamaged. My best heuristic so ...
4
votes
0answers
84 views

find and symbolic link

I was skimming over the documentation of find to better utilize the command usage. I was reading the part that says GNU find will handle symbolic links in one of two ways; firstly, it can ...
2
votes
0answers
15 views

Appending the content of a file to files in another directory tree

I want to append the content of a file in my current directory to all the files in another directory recursively (so I need to append the content of that file to the files in the subdirectories too). ...
2
votes
0answers
117 views

locate: using updatedb to create a database of directories only?

GNU findutils' man page for updatedb says it has a --findoptions parameter. Does it mean I can specify a find-like option there to create a specific database for locate? Like this, to include ...
2
votes
0answers
43 views

Prompt user with email when Disk Usage is over 200GB

find . -printf "%u %s\n" | awk '{user[$1]+=$2}; END{ for( i in user) print i " " user[i]}' Hi I have been using the above CMDline to look for each user's disk usage information. I would like to know ...
2
votes
0answers
296 views

find - No such file or directory albeit it exists

I run the following command on a directory: find . -name "*.pyc" -type f -delete however it prints this find: -delete: unlink(./tests/unit/framework/__init__.pyc): No such file or directory for ...
2
votes
0answers
5k views

rsync only files newer than given date, with --delete

I'm trying to use rsync to backup only the files that have been created or changed after a certain date. The reason is that on that date, the whole system has been backed up. However, those global ...
2
votes
0answers
224 views

Backup using find and ssh to off-site server

I'm sure this has been been answered in bits and pieces on many sites, but somehow I can't seem to get this (as a whole) to work reliably. Scenario: I have a server that I would like to do ...
2
votes
0answers
181 views

What is SELinux's regex type?

I'm trying to locate all files on my system matching an SELinux file context (fcontext). These contexts are specified using some regex, and I'd like to use find -regex ... to the same effect. However, ...
1
vote
0answers
16 views

Find + regex: looking for a file name with multiple extensions, but missing the basic filename.jpg

I'm both a regex & SE Unix and Linux newbie, so I hope I'm doing everything right. I'm looking for files that have a name inside of the filename, and could have different extensions. I based my ...
1
vote
0answers
25 views

Which tools can find unicode (UTF-8) text in files containing any form of normalization?

I like to find international text, like "müller", or even chinese text, in files, no matter which unicode representation and case is used. I.e, it should not matter whether the "ü" is stored in NFC ...
1
vote
0answers
67 views

awk print tab delimited columns with find execdir

I am trying to print out columns that are separated by tabs. First, I use find command to identify a list of files to process. Second, I parse the file path to generate the filename to be used for ...
1
vote
0answers
107 views

How to exclude a directory or partition on pmlogger scan?

As on the details below it look like that the cause of the problem is the pmlogger is spawning the find command. And its takes a long time for the find to scan all the files in one of my partition. ...
1
vote
0answers
88 views

What to grep on result of find function

find . -type d -regextype sed -regex ".*some_pattern.*" -exec sh -c 'grep -Ril "find_it" $0' {} \; What I want to achieve here is to narrow down a number of folders against which grep should be run. ...
1
vote
0answers
71 views

Emulating git status --ignored in non-repository folder

This might be in essence a duplicate of this question, however the perl script provided did not work in my case as far as I can tell. There are also many questions about finding multiple patterns, but ...
1
vote
0answers
177 views

Find directory containing file; execute command in that dir; then delete files

I want to find all directories (recursively) which contain .cue files, execute a command in that directory, then delete all files in that directory with the same prefix as the .cue file. find . -name ...
1
vote
0answers
42 views

Find files inside sub-directories with different names (to remove them with mtime)

I have a set of client folders on a server. Each client has backups inside a "backup" directory like so; ~/backups/<CLIENT_NAME>/{daily, weekly, monthly}/{databases, directories, logs} I'd ...
1
vote
0answers
114 views

Move or copy files of certain type from subdirectories of same name

I need to pull all mp4 files from a set of directories with the following type of structure. Jan -Folders - -888 - -777 Feb -Folders - -888 - -777 Basically what I need ...
1
vote
0answers
343 views

find and copy files change the modified date to 1980-1-1

I use command to find and copy files in cygwin in windows . My command is find -name '*.docx' -exec cp -p -t /word {} + however , when the files is copied to destination folder, I can see the ...
1
vote
0answers
644 views

Using Rsync to SSH and Find files

Hello I am trying to use Rsync to SSH into a remote server and pull a certain type of file that has been modified within the last 24 hours. Here is what I am trying: rsync -avx --timeout=480 --...
1
vote
0answers
302 views

trash and restore script - issue restoring

#!/bin/bash echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" read ans case "$ans" in Yes) echo "$(readlink -f $1)" >> "$HOME/TrashLog" && mv "$1" "$...
1
vote
0answers
196 views

Find command incorrect results with days filter

I am trying to find all files modified before march 6 in a directory with thousands of files. I executed the following commands in the PWD where I want to find files. find -mtime +47 > /root/...
1
vote
0answers
72 views

GUI for find which can show video thumbnails

Is there a GUI for find (or just a graphical search tool which supports regex searches on filenames starting from a specific directory) which is able to show thumbnails found video and image files? I ...
0
votes
0answers
24 views

run script continuously and check for error

I have written below script and it reads the file and when ever there is any 400* or 500* word it will give me error message, and now I want to add two more functionality to my script. I added the ...
0
votes
0answers
37 views

BASH Script to find files of multiple types

I switch a lot of people from Windows to Linux. As we all know, not all files on Windows end at their intended location (i.e.: the Downloads folder). I'd like to run a BASH script to search for all ...
0
votes
0answers
54 views

What is a great way to list files found in a directory that add up to a certain file size

This list will then be used to create tar balls for easy movement. This is what I came up with so far. Add up files that are just greater than 10GB list them to file. find . -type f -exec ls -al {} ...
0
votes
0answers
17 views

Copy specific named directories, where content changed the last 24 hours

I can recursively find and copy all my test-directories (with content) of the current directory: find . -name test ! -path "./my_dest/*" -exec cp -r --parents {} /path/to/my_dest \; But now I want ...
0
votes
0answers
61 views

Using egrep in a find command to search for a variable and a constant

I'm working on a bash script to search a set of log files that record login attempts to the server and isolate if the most recent attempt resulted in an account lockout. First, I crafted a a variable ...
0
votes
0answers
66 views

IFS variable and filenames with spaces and newlines

(Using Bash 4.4 and 5.0) I am dealing with the issue of filenames that contain spaces, newlines and backslashes. I often read the suggestion to use code like this: oldIFS=$IFS IFS= while read -rd ...
0
votes
0answers
37 views

copying files from recursive directory to a folder with find command on Jupyter

In my current directory, I have several subfolders. I want to copy all the files from subfolders into just one folder called 'data'. I am working with python3, Jupyter notebook on a remote. Inside the ...
0
votes
0answers
64 views

problem with find xargs and tar concatenation

I want to store all the png files in a directory tree. I used find . -iname *.png| xargs tar -czf renderresultsall.tar.gz but I get only a part of the files, some directories are missing e.g. ....
0
votes
0answers
37 views

Find with '-type d' not working if the path contains symlinks?

I have a directory structure something like this (I've simplified it for this question): /dirX /dirX/d/d1 [and contained files+subdirs] /dirX/d/d1/d2 [and contained files+subdirs] /dirX/d/d1/d3 ...
0
votes
0answers
425 views

Is there a way to use find to filter a file list?

I have the output of locate --existing --regex that was quite fast to obtain. A similar find takes several hours - it's a huge volume. I would like to apply further find filters to this file list. ...
0
votes
0answers
57 views

Delete matching files from script

Couldn't piece together why this happens. In this folder /usr/local/nginx/html I want to delete all or sky21.ts, sky22.ts, ... to sky29.ts. If I run this command directly in the folder find /usr/...
0
votes
0answers
38 views

Find not finding changed files in untestable conditions

I have a website on a hosting provider, which allows cron jobs to be set up via cpanel. I have the below cron job set up. The problem is it is returning 'No Changes' when I know there are changes ...
0
votes
0answers
650 views

Fastest way to recursively list all the files in a directory

I'm trying to get the relative path of all the files in a directory. It can run on hundreds of thousands of files so I need it to be fast. I've tried find . and rg --files (rg being ripgrep) and rg ...
0
votes
0answers
110 views

xargs interface for tar balls

I want to have an xargs-like interface to operate transparently on large tar balls without unpacking the whole archive at once. I've made already this shell script prototype xargs-tar which unpacks a ...
0
votes
0answers
516 views

rsync, find, and other useful commands for synchronizing a large quantity of data

Here is the structure of the folders I would like to consider: /mnt/network/ is my network drive and /local/ is my local folder. What I want is to synchronize the content of these two folders (...