Questions tagged [find]

search for files in a directory hierarchy

Find is used to look files in a directory hierarchy. You can refer to its manpage here.

Examples:

Look for all files on a server owned by user siegfried:

 find / -user siegfried

Find all files ending in php en remove them:

 find / *.php -exec rm '{}' \;
314 questions
0
votes
2 answers

Can you cache the 'find' command?

I wrote a simple shell script which uses the 'find' command so non-technical users can do a search on the file server through a web browser on the LAN. It works, but sometimes it has a long execution time, and then the follow-up searches are…
Edward_178118
  • 955
  • 4
  • 15
  • 33
0
votes
1 answer

crontab not working for deleting a old files from log folder

I have this line in my crontab to delete old files: 1 * * * * find /var/log/abc/ -mtime +7 -type f -delete Unfortunately, it does not work. I have attempted to give all users permission to clear that folder using chmod +777 /var/log/abc But the…
Ginger
  • 103
  • 6
0
votes
0 answers

BAT script to return server licenses at shutdown?

My office uses program licenses that have to be manually activated and returned, and people tend to forget to do this when they go home for the day, resulting in most licenses tending to be unavailible for anyone coming in early next morning and…
-1
votes
3 answers

Centos find coredump files

I want to use regex to find all coredump files under a directory. The pattern of the file name is core.1234 find /public_html -type f -regextype sed -regex "core.{[0-9]+:[0-9]+}" Please advice.
Tester
  • 177
  • 1
  • 1
  • 7
-1
votes
1 answer

Find and rm command not deleting recursively

We have a simple scripts that suppose to delete old folders. The problems is that it doesn't delete them recursively. This is the command: find $PWD -maxdepth 5 -mtime +80 | xargs -I{} rm -Rvf {} It removes the files and folders but suddenly tries…
yanivhs
  • 3
  • 1
-1
votes
2 answers

Find all files which contain pattern in directory of tar files

I have all tar files in a directory. I want to find some files in tar files without extract all tar files. I know how to work with one tar file: tar tvf abc.tar | grep xyz I want to find in all tar files but I don't know how to.
Minh Ha Pham
  • 121
  • 6
-1
votes
1 answer

Using rsync with StrictHostKeyChecking and find files older than 5 minutes from remote

I would like to use rsync to sync my files from remote to a local directory. Therefor I use StrictHostKeyChecking so that there's no need to enter a password. Now I would like to only sync files older than 5 minutes. I thought to use find…
mediii
  • 3
  • 2
-1
votes
1 answer

Cygwin find integration

I would like to find all NON read-only files in my directory using cygwin's find command. Is it possible ?
m_vitaly
  • 139
  • 4
-1
votes
1 answer

Linux Delete Files Older Than and the Same Time Smaller Than

I use this command to delete MP3 files older than 90 days. find MP3/ -type f -name "*.mp3" -mtime +90 -delete I want to make it delete those older than 3 days but with file size less than 100KB. How to write the arguments for < 100KB and is -size…
medk
  • 111
  • 1
  • 7
-2
votes
1 answer

On Unix on could I get a listing of all mp3 files inside a directory containing other directories with their full path?

Someone said to me use the find command but I'm not exactly sure how to do it. Basically I need this: suppose I have a folder called dir1 and it contains three sub-directories (dir2, dir3 and dir4 respectively) and suppose there might be mp3 files…
user41157
  • 189
  • 2
  • 9
-3
votes
1 answer

Cloud server running slow

Can anyone help with this: One of our cloud servers is running slow and after running iotop I've noticed the below command running for nearly 2 hours, but I'm the only one who would run commands on this server. I haven't and there has been no…
-4
votes
3 answers

Is searching for a file on a live production server a bad idea?

On our live production server, we forgot which folder our website was stored in. My colleague asked me where it was. I did not know but suggested to just run a search for the folder name on the server. He responded that you can't do that, as it runs…
Nick
  • 173
  • 1
  • 5
-4
votes
3 answers

Find in all sub directories

I have a directory with many sub directories, I want to find a file in this directories so I use this command: find ./ -name test.php but this command search just in the top level directory, how can I search in all sub directories too?
MajAfy
  • 107
  • 2
  • 6
-5
votes
1 answer

chmod for all sub directories

There is command that change the folder permission for all subfolders find . -type d -exec chmod 755 {} \; I understand d is for directory and chmod 755 to make all directory as 755 I want to know what is the meaning of {} & \.
Aftab
  • 113
  • 4
1 2 3
20
21