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

learn more… | top users | synonyms

0
votes
1answer
16 views

find files with two types of extensions last modified over 30 days ago

I want to find all the files in a directory that have not been modified for at least 30 days and end in .xml or .out. This is my attempt to cobble together a couple of references to build the right ...
0
votes
1answer
22 views

Find and convert all ALAC files to mp3 / opus / aac

I'm looking for a way to convert all alac files in a directory recursively to another format. Problem: alac as well as aac use suffix m4a, so find -name "*.m4a" doesn't work.
1
vote
0answers
15 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
2answers
125 views

Does change of a file in a directory not change the time of the directory?

I want to find a file which I created recently, but I don't remember anything and can only guess it is under a directory indirectly with any possible depth. I inspected the times of all the ...
1
vote
2answers
24 views

query all symbolic links to a directory

HP-UX ***B.11.31 U ia64 ***** unlimited-user license. $ ls -al 10 May 9 2011 HORCM -> /opt/HORCM 8 May 9 2011 bin -> /usr/bin 0 Mar 29 2012 core Feb 18 05:36 dev How do I list the link ...
1
vote
1answer
31 views

if command in find -exec

I was just trying to list all directories and files under current directory and also write if they are file or directory with the following command: find -exec echo `echo {} : ;if [ -f {} ]; then ...
1
vote
2answers
42 views

How do I find folders containing no recently modified files?

I have a directory that gets a lot of data dumped into it, and I want to find all directories whose contents haven't been modified recently (e.g., in the last 5 days). I'm trying to compose a call to ...
3
votes
0answers
34 views

find printf switch POSIX alternative

I'd like to rewrite these 2 command so they will use only POSIX-complaint switches: find "$TARGET_DIR" -maxdepth 1 -type d -printf '(DIR) %f\n' find "$TARGET_DIR" -maxdepth 1 -type f -printf '%s %f ...
1
vote
3answers
38 views

Find files based on modified date(specifying the exact hour) [duplicate]

My question is: How to find files that has been modified from a given date(specifying the exact hour) to another given date(specifying the exact hour) in a given directory, from / for example. I ...
1
vote
2answers
67 views

How to list only JPEG files from root below using the command line ?

I am searching for a method to find only JPEG files, With my limited knowledge of Linux I came to this point: 1. list all paths that exist from root below with find / 2. pipe the result into next ...
6
votes
3answers
150 views

What do the “features enabled” in GNU find mean?

When I use find --version with GNU find, I get something like this: find (GNU findutils) 4.5.9 [license text] Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) ...
2
votes
2answers
75 views

Using find to list all files under certain directory

I'm trying to use a single line command that will find every directory (or sub-directory) named bin and will then print a list of all the files under it, but will not also list the directory names ...
0
votes
2answers
41 views

find {} returns the full filename but I just want the filename without the extension, so index.md would return index instead of index.md [duplicate]

So I have find . -name \*.md -type f -exec pandoc --filter ./filter1.py -o {}.html {} And notice the {}.html. The {} returns a filename ending with .md, but I want it to just return the filename ...
5
votes
3answers
283 views

How do I move all the files with the same name scattered through the file system into one folder?

I have a file system tree and on different locations within it are files with the same name. I tried the following command on the command line: find / -name "HAHA" -exec mv {} /home \; It only ...
0
votes
2answers
23 views

how do I find the location of mysql drivers on CentOS 7?

MariaDB is installed on a remote CentOS 7 server. How can I find the location of the nearest equivalent to mysql-connector-java-5.0.8.jar in the server's file system? grep seems to only search ...
2
votes
2answers
46 views

Find and rm command not obeying exclude list occassionally

I am running a find and rm -rf directory list modified earlier than 7 days with an exclusion list of directories which should not be deleted at any case. This is the script excerpt find ...
0
votes
1answer
23 views

Why does the “-or” flag to GNU find cause my expression to evaluate in an unexpected way?

The following works as expected: [pitserver ~]% sudo find /home/pitserver/operator -uid 11 -exec ls -nld {} + drwxr-xr-x 2 11 28 4096 Jan 30 2006 /home/pitserver/operator -rw------- 1 11 28 32 Oct ...
2
votes
3answers
57 views

Optimise a shell script / command to delete files

I'm running Magento and it doesn't clean up old session data, so I need to clean it up with a shell script / cronjob: 0,30 * * * * /usr/bin/find /var/www/magento/var/session -name 'sess_*' -type f ...
1
vote
1answer
23 views

find's - cnewer broken on NTFS-3g?

After extracting an archive to the wrong place, I thought I'd erase everything created after it, but find . -cnewer archive.7z gave the wrong results. So I made a controlled test by touching three ...
1
vote
2answers
94 views

How to handle spaces in path names when variable contains multiple paths [duplicate]

Although I've read myself through most of the questions about handling spaces in path names, I haven't found my case yet, which is about several path names in one variable. find will need this when ...
1
vote
0answers
25 views

What types of regex DO support (e.g.) negative lookbehind?

Bash on GNU: I am using a collection of find commands, most of which employ -regex to do their matching. Each time I try a different feature in my regex I have to cycle through the values for ...
1
vote
3answers
58 views

Shell script to find and count total number of characters in all the files

How can I make a script that finds every file in your home directory that is less than 3 days old and then gets a count of the total number of characters in all of these files?
0
votes
0answers
8 views

How can I find and list files that begin with a period? [closed]

I want to delete all the files on my server called .DS_STORE and .THUMBS I tried the following to find these files, but they all came up empty. I know for sure there are some there. > find . ...
0
votes
2answers
82 views

Remove all files recursively without deleting directories

I want to "clean out" all of the files a directory including all files in subdirectories but I want to leave the subdirectories in place. My understanding of rm -r is that it will also delete the ...
3
votes
3answers
60 views

How to bump file timestamps by 3 months (for a directory tree)?

I am looking at the touch command line utility (on Linux), and from the examples I found in tutorials, I see how one can bump the access or modification timestamp to a specified time, the current ...
1
vote
2answers
49 views

List the files of another format while finding a certain name pattern

I had wanted to edit the txt files of videoA and videoB only if the movs files names contains the namespace -test For eg. videoDir |-videoA |- videoA_v001_test.mov |- ...
2
votes
3answers
81 views

Using find with 2 sets of variables

I want to be able to run a find command in my bash script that will find files based on two seperate variables. I've gotten this far but I'm not sure how to get the final result workingfind . -user ...
1
vote
0answers
31 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
2answers
35 views

Using find and aspell together

I'm trying to spell check all the *.md files in my current directory but the following command fails: >> find . -maxdepth 1 -name "*.md" | xargs -I {} aspell check {} xargs: aspell: exited with ...
-1
votes
1answer
30 views

How to search for all SUID/SGID files?

All the howtos that I find on the web states: Find all SUID files: find / -perm -4000 -print Find all SGID files: find / -perm -2000 -print But that is not true. See: $ ls -lah test -r-sr-xr-x ...
1
vote
1answer
33 views

Using Rsync in conjunction with Find

I'm am attempting to write a script that will copy files created in the last 24 hours AND be of a specific file-type (*.png). The command I have tried is: rsync -avz --ignore-existing ...
2
votes
1answer
110 views

bash find: get directory of found file

I have a parent folder named "parent_folder" with a lot of subfolders, in these subfolders is a file named "foo.mp4". I can find these files easily by doing this: mymacbook:parent_folder username$ ...
-1
votes
1answer
37 views

Check exist file on another pc

Yesterday I had ask how to use my tftp protocol in my bash script: Debian - Using TFTP in a bash script And now I have a problem with my tftp protocol. The file who was taken depend of my Hostname. ...
1
vote
2answers
87 views

Multiple File Redirection with awk and find

I have some files in a directory. And I want to add some lines at top and end of file using awk. Example: My awk command: awk 'BEGIN { print "line1\nline2" } { print $0 } END { print "line3\nline4" ...
0
votes
2answers
37 views

How to make a script to move files with find and regex

Im trying to make a find regex script so i automaticly can copy files to specific directory. find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ \; Made this script, dont ...
1
vote
3answers
26 views

Find file by magic pattern maching

There is a bash command file(1) which outputs a file's contents type according to the matching pattern definitions in the /etc/magic and /usr/share/misc/magic. Is there a way to use these pattern ...
4
votes
2answers
86 views

status check for sleep command

I have run sleep command in background as follow , How can I know the status of execution ..? Command sleep 2d ; find /home/disk1/ -exec touch {} \; & How can I know that its executed for 1 ...
0
votes
0answers
40 views

Why is the “move” word necessary when using find + xargs + rsync in this example? [duplicate]

I often use this sort of command on my Mac to transfer files remotely: find . -iname '*.txt' -print0 \ | xargs -0 -J % rsync -aP % user@ip:/foo/bar I had to perform this on Linux. Since GNU ...
5
votes
2answers
122 views

Create symlink tree in existing directories

I carry all of my music around on a 1TB USB drive and have a udev rule to symlink it to $HOME/Music/ when I plug it in to one of my laptops, which it does. The issue I have is that this works fine ...
1
vote
3answers
50 views

How to express all files/directories at the extra -exec option of `find` command?

I have a task to copy all files from multiple directories with special names to a target directory. So I build this directory to test my command. The test directory tree looks like: . ├── dir1 │   ...
5
votes
1answer
138 views

Why does 'find -exec cmd {} +' need to end in '{} +'?

Preface: I understand the difference between -exec {} \; & -exec {} +. I also don't have a problem as such, I am just curious about the semantics of find. When ending the -exec argument with + ...
2
votes
3answers
66 views

Print file name extension using -exec in find

I am playing around with -exec flag of find command. I am trying to use the flag to print the extension name of files, using a fairly new Linux distribution release. Starting simple, this works: ...
0
votes
2answers
50 views

find files in linux with some exceptions

I am trying to make a command which will find all the files modified in past 24 hours and which are PHP only with a loop to look into each public_html directories and save the output into a HTML file ...
0
votes
6answers
49 views

How do I deal with directories that have spaces in their names from `find`? [duplicate]

I have this: #!/bin/bash for file in `find . -type d` do echo $file done If I have just one directory called My Directory, the output is My Directory How do I fix this? The echo $file is ...
2
votes
2answers
85 views

Separate filename and path inside find command's -exec option

I'm struggling with escaping and expression evaluation. I am trying to run a command inside a find...-exec COMMAND structure, where COMMAND operates on one file and outputs to the stdout. To use ...
4
votes
3answers
275 views

Getting the -exec option in find to work

I am trying to make find print out a list of directories that contain files other than jpg images, but I think my use of the -exec option is broken. My environment is Cygwin Bash. $ find ! -iname ...
1
vote
4answers
191 views

Bash rename 360 000 files using find -exec

I've got around 360 000 files like: ./001/1/1.jpg ./001/1/2.jpg ./001/2/1.jpg ./002/1/1.jpg ./003/1/1.jpg ... pattern: [60 dirs]/[1000 subdirs]/[4-10 files].jpg I want to rename files using rename ...
4
votes
1answer
59 views

Find files recursively that are older than one year and not owned by a specific user

I'm trying to find any files on a specific mount that are older than one year and do not belong to a specific user. This is the command I'm using (within the root directory of the mount): find . ! ...
0
votes
1answer
33 views

Tried to mv folder, now having trouble finding folder

Yeah, so I was trying to move a folder around, and now I'm having trouble finding it. Originally it was in my .../Downloads/ directory. I did: sudo mv Downloads/Blah/ ~/ ... which seemed to work ...
2
votes
2answers
89 views

Did I unintentionally delete my entire hard drive?

A while ago I backed up a Linux folder onto a Windows disk drive I had lying around. Recently I was scanning through those files when I realized that I had unintentionally copied over many unwanted ...