search for files in a directory hierarchy

learn more… | top users | synonyms

3
votes
7answers
9k views

Remove path from find command output

I have a bash script for deploying code from a beta environment to a production environment but currently I have to add the list of files to a txt file manaully and sometime I miss some. Basically my ...
2
votes
4answers
833 views

Delete old files in large folder

I have a folder which contains many files. I want to delete files older than 30 days, so I use the command: find cache/ -mtime +30 -exec rm {} \; But my SSH session disconnects before the command ...
1
vote
3answers
4k views

how find datacenter using a ip address related to that datacenter? [closed]

I have a vds and it's really good! I have some problems with my reseller of that server because of their support. I want to buy a server from that datacenter directly. How can I find that datacenter ...
0
votes
4answers
293 views

find command + exe status diff from 0 when file not found

how to enable find command to print exe status diff from 0 when find command not find the file? according to my example when I try to find the test1.txt file , $? set to 0 but I expect to get value ...
2
votes
5answers
4k views

What is the correct find -exec syntax

I wanted to delete files that were greater than 2MB within a specific folder. So I ran: find . -size +2M And I got a list of two files ./a/b/c/file1 ./a/f/g/file2 So I then run: find . ...
8
votes
5answers
3k views

Linux find command - show progress

I was wondering if there's any way to display some kind of progress info when searching for files in linux using find. I often find myself searching for files on a big disk and some kind of progress ...
4
votes
1answer
5k views

Find, and sort results by date created

How can I sort the results of find? I want to sort by date created asc? find /docs -type f | sort Sorts by filename not date created. Thanks.
0
votes
1answer
309 views

Issue with rsync -R wrapped in a find command

I'm trying to copy all the files named 'specials.xml' in the current and all subdirs, and also create the name of each sub-directory. I'm using -R to rsync so it creates the relative paths for each ...
2
votes
3answers
252 views

How do I find this string?

I'm trying to match these file names with the find command: 4702011-10-21CR719557-R85262-ALPHA.jar 4702011-10-21CR719557-R85262-BETA.jar I'm reasonable familiar with Java-Perl regex syntax. ...
0
votes
1answer
260 views

Reverse and modify copy file to all subfolders command, xargs

i found this online it copy file to every sub folder on the current dir for full tree depth find -maxdepth 1 -type d -print0 | xargs -0 -n1 cp -v .htaccess now would be nice if it could ask if ...
1
vote
2answers
79 views

Can find show directories with contained directories' time stamps?

I have a script to clean out old files and directories in a log area like: find . -mtime +${NUM_DAYS} -type d -exec rm -rf '{}' \; However if I run this 2 levels up from the files that have changed ...
2
votes
4answers
3k views

Find the location of libmysqlclient.so.X file in Linux environments

I'm putting together a script that has a requirement of knowing libmysqlclient.so.[15|16|18] .so file. It's usually located in /usr/lib/ , /usr/lib64/ or a mysql/ subdirectory of the aforementioned ...
1
vote
3answers
3k views

How do I search by multiple keywords when using awk or grep?

I have a collection of files. I want to search through them all with grep to find all and only those which contain anywhere within them both the strings keyword1 and keyword2. I would also like to ...
17
votes
4answers
11k views

Bash find command verbose output

Good time of the day, Is there way to tell the bash "find" command to output what it is doing (verbose mode) ? For example for the command: find /media/1Tb/videos -maxdepth 1 -type d -mtime +7 -exec ...
3
votes
2answers
518 views

find all directories having less than x files inside

Assume starting at some directory in the filesystem. This base directory has lots of subdirectories (not nested!). Each of the subdirectories has an arbitrary number of files withing. How can I find ...
0
votes
5answers
223 views

search files based on text file containing list of files

I have a text file containing file names only (it does not contain their paths). I need to find these files which may lie in any of the subfolders and then copy or move them to other location. To find ...
2
votes
1answer
244 views

Find and delete all but N largest files in 100s of directories

I have 100s of sibling directories on a BSD/Unix system, each with a collection of files in it. I'd like to delete all but the N largest files in each directory. (N is 5 for me.) Assuming that I can ...
2
votes
2answers
1k views

How to use sed, perl to rename files and its contents with a particular pattern in a given directory?

Given a directory "Centos1" which has few files named Centos1.x, Centos1.y, Centos1.z and these files also has "Centos1" in their contents. Using a single command ( using find, sed, perl -pie ) how ...
1
vote
2answers
566 views

How to find .h,.c and .cc files under current directory in linux?

find . -name "*.[hc]|*.cc" The above doesn't work,why? UPDATE How do I find these 3 kinds of files with a single pattern?
0
votes
2answers
59 views

Running expand on a set of files

I'm trying to run the expand shell command on all files found by a find command. I've tried -exec and xargs but both failed. Can anyone explain me why? I'm on a mac for the record. find . -name ...
1
vote
2answers
513 views

find files and search for within tail

The following is working as expected. find /opt/ -name "somefile.out" -exec grep 'Connection refused' {} \; | more But if I want to search only in the tail of the found files, I can not add tail or ...
0
votes
3answers
47 views

can not find a directory with find command

I tried using the command sudo find / -type d -iname firefox It gave me the following output /usr/share/doc/firefox /usr/lib/firefox /home/ashu/.mozilla/firefox /etc/firefox But i have a ...
1
vote
1answer
282 views

Using Find, Grep, Awk, or Sed To Rename Server After Cloning

My client tells me they have cloned a VM in VMWare of an Ubuntu Linux server. Now it's my job to get into all the files and find out what still has the old server name of "bishop" and change it to ...
1
vote
1answer
277 views

MySQL can't write to tmp folder, how do I find this tmp folder

MySQL (using MAMP) says it can't write to Can't create/write to file '/private/var/folders/AO/AOyal7b0GU844L1VJDb3Bk+++TI/-Tmp-/#sqld035_6_0.MYI But using finder I can't find this location. How can I ...
0
votes
2answers
405 views

find command to find php files but exclude a certain directory

How do I run a find command to find php files but I exclude a folder i.e. /usr/local/bin?
1
vote
3answers
4k views

How do I find all files of a specific type in RHEL on the command line?

I am looking for files of type .flv, .avi, etc I would like to see a list of all the files (on my server) of those file types (I don't mind doing it one by one, i.e. seeing all the files of .flv, ...
6
votes
3answers
3k views

Non-recursive find on linux

I am trying to find all directories that are directly inside the current directory and older than a specific age. The trick is, I only want to consider the age of the immediate descendants of the ...
0
votes
2answers
64 views

How to find mail on shared linux hosting and delete after forwarding

I'm forwarding mail from a shared hosting account to a gmail address. The mail forwarder does not delete the mail after forwarding so the directory is getting full. I tried the following in a cron ...
8
votes
3answers
6k views

How can I handle spaces in file names when using xargs on find results?

One of my common practices is to perform greps on all files of a certain type, e.g., find all the HTML files that have the word "rumpus" in them. To do it, I use find /path/to -name "*.html" | xargs ...
7
votes
1answer
6k views

How do I find circular symbolic links?

I'm working on a HP-UX system and I want to find if there are any circular symbolic links. So far I'm using the command: ls -lrt `find ./ -follow -type l` But it's only doing ls -lrt on current ...
0
votes
1answer
576 views

How does find command sort results?

I have an old messy shell script. One of the steps executes find command with some parameters and expects the results to be sorted by creation time. It works well on old machines (find version is ...
2
votes
4answers
1k views

How to bulk rename files to remove an extraneous space from before the extension

I have a bunch of files who's filename follows the pattern 'filename.ext'. eg: filename .ext I would like to rename all of these to remove the space before the .ext. eg: filename.ext I can find ...
2
votes
1answer
703 views

How to find files with trailing slash in linux

I have some files in the filesystem that end with a trailing slash like so: my_text_file_1.txt\ some_other_file_2.pl\ I usually use find for these cases, but the following did not work: find . ...
1
vote
5answers
766 views

How to restrict Linux find by prefix?

I have a directory A with a large number of sub directories and files and want to get a list of all files named foo that are inside of a directory in A that matches *bar. E.g.: Yes: ...
0
votes
2answers
113 views

Looping in a directory to find a folder and delete

I use Dreamweaver to upload the web page to my site, it bring a folder called _note to everywhere in my site. I would like to ask how can I loop in the directory(/home/user/htdocs) to find the folder ...
4
votes
2answers
348 views

Difficult to Delete Files in Linux

There's a lot of stuff about this on the Internet, but most of the examples there are contrived. How does one delete files that are really stubborn? e.g., $ find ./ -inum 167794 ./àKÈÿÿÿÿ@ $ find ...
0
votes
3answers
14k views

List all files added/modified on date

How can I use the find command to list all files for example modified on april 9 2011. Thank you, Chris
0
votes
5answers
317 views

Find all files recursively by a certain date

My site is compromised by an FTP brute attack and the cracker modified / created some files in my home directory. Let's say the date of the malicious creation / modification is 2011-4-5 21:38:09. ...
1
vote
3answers
836 views

Dos find command? [closed]

Are there any utility find commands that you can download and use in DOS which match the UNIX find command?
0
votes
2answers
2k views

How to compare to text files using command line tools, under windows [closed]

I have to sorted files, say A.md5 and B.md5. I would like to write a small windows batch file, which returns the lines (in my case a list of files), which are present in A but not in B (not case ...
0
votes
1answer
433 views

Creating an MD5 file for a directory tree for only a given extension

I would like to create an MD5 file of a directory tree, containing only the bare names of the files. md5deep exactly does that, but it cannot filter for files when in recursive mode. md5deep -rb . ...
6
votes
3answers
5k views

finding a file which was modified in last 10 minutes

I am running this command to find out the files which were modified in last 10 minutes find / -fstype local -mtime -10m but it is giving following error each time find: missing argument to ...
24
votes
8answers
58k views

how to find out mac addresses of all machines on network

Is there some easy way to find out mac address of all machines on my network rather than doing an SSH into each and ifconfig | grep HWaddr if there are 300 machines on network I really need some easy ...
3
votes
3answers
590 views

find files their name is smaller or greater than a given parameter

Say that in a given directory I got tzury@x200:~/Desktop/sandbox$ ls -l total 20 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P000 drwxr-xr-x 2 tzury tzury 4096 2011-03-09 10:19 N00.P001 ...
2
votes
2answers
88 views

How to list directories that aren't being symbolic linked to in a directory?

I'm trying to do some cleanup similar to this question. In a UNIX OS, I want to delete the directories that aren't being symbolic linked to in a given directory. e.g. I have a deployment script that ...
-1
votes
1answer
73 views

Cygwin find integration

I would like to find all NON read-only files in my directory using cygwin's find command. Is it possible ?
1
vote
2answers
413 views

finding a group of string common in two files

I have used diff command in past.I faced a situation to which I did not had a clue here are some text strings (which can be stored in a file) CONFIG_XEN=y CONFIG_XEN_PVHVM=y ...
0
votes
4answers
906 views

how to find a text string which may be present in some unknown file in entire filesystem

I am stuck up with a problem I have a line 'something' in some file. In which file is this line that I have forgotten. In the entire root file system I would like to find out which file and where is ...
17
votes
2answers
3k views

How to find files in a Debian system not installed or created by dpkg?

I've installed some things manually in the past and would like to weed out all related files. So, I need a way to automatically find all the files (in /usr, for example) that are not included in any ...
5
votes
2answers
1k views

List directories not containing a file

I've seen similar questions to this, but nothing I can find related directly to files. Is there any way to give me a list of directories which do not contain a specific file? Example: /dir1/good ...