Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [find]

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

3
votes
1answer
90 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
297 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
67 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
382 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
81 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
22 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
44 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
36 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
35 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 ...
1
vote
1answer
32 views

Using find to only step through symbolic links n times?

Is it possible to use find to recursively search a path but to only step through into a path which is symbolic link to a specified depth of n? There is -maxdepth but this includes regular directories ...
1
vote
1answer
107 views

How to move files from certain directories to newly created directories based on their extension?

My case is that I have multiple .m3u8 and .ts files existing in their corresponding asset folder, e.g., /vod/CDN/ABC/index/.m3u8 and .ts /vod/CDN/DEF/index/.m3u8 and .ts ... /vod/CDN/XXX/index/....
1
vote
1answer
347 views

find and replace macro in libreoffice

How can I write a find and replace macro to merge many items in few, as "USA, Mexico, Canada, Honduras" in "America", "China, India, Vietnam" in "Asia" and so. Before macro: USA, Mexico, Canada, ...
4
votes
0answers
79 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
82 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
73 views

How to delete files and directories that are not in backup directory

I have backup of /home/kuba/mp3 on external usb hard drive /media/kuba/JCUBIC/mp3 and I move some files to different directories on usb drive and now I want to sync the files from usb to my home ...
2
votes
0answers
285 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
4k 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
221 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 ...
1
vote
0answers
38 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
80 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
84 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
58 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
173 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
41 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
113 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
320 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
171 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
636 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
299 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
195 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
71 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
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
62 views

cannot find Trash folder! Ubuntu 18.04

I am running a preinstalled version of ubuntu 18.04 but cannot find Trash folder. The typical places don't have the folder. ~/.local/share/Trash <-- does not exist /root/..../Trash <-- does ...
0
votes
0answers
56 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
47 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
21 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
53 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
35 views

Linux Mint to Windows Server via SMB: find, copy rename with pwd - save to netwok location

I am trying to find file of various types (*.pst), append their directory location to the current file name and copy them from a local hard drive to a network location. find . -name '*.pdf' | cpio -...
0
votes
0answers
36 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
371 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
53 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
37 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
55 views

The find command is taking a long time to complete its execution

The following find command is taking a long time to complete its execution: find / -name test.txt -type f -print -o -fstype nfs -prune Why is this?
0
votes
0answers
592 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
104 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
495 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 (...