search for files in a directory hierarchy

learn more… | top users | synonyms

0
votes
1answer
198 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
238 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
237 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
78 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
2k 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
2k 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 ...
13
votes
4answers
8k 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
401 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
208 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
213 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
463 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
56 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
340 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
44 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
258 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
244 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
321 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
3k 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
2k 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
63 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 ...
5
votes
2answers
4k 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 ...
5
votes
1answer
5k 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
569 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
899 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
523 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
568 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
112 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
323 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
12k 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
271 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
779 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
1k 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
378 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 . ...
4
votes
3answers
3k 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 ...
23
votes
8answers
46k 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
449 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
72 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
344 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
783 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 ...
14
votes
2answers
2k 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
850 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 ...
2
votes
5answers
895 views

Find files containing a string on the whole filesystem

I need to find all the instances of a given string in the whole filesystem, because I don't remember in which configuration files, script or any other programs I put it and I need to update that ...
7
votes
4answers
1k views

Bash: execute command on results of FIND

I am trying to resize all files that are found using a FIND command (they are all files within a directory and its subdirectories). I tried many options but stumble across different errors each time. ...
3
votes
3answers
743 views

sh script to remove just txt files using find and exec rm warns me of missing argument to exec

find /full/path/dir -name '*.txt' -exec /bin/rm {} \; Fine in a shell, but pop it in a sh script along with some similar lines, to get it to run nightly from a cronjob, and it reports: find: ...
1
vote
1answer
65 views

find command + print manipulation

with the following command: find /tmp -depth -name file I get the: /tmp/file /tmp/test_file/file But what I need to add to find command in order to get the following print? ...
1
vote
2answers
2k views

Recursively rename files using find and sed

I want to go through a bunch of directories and rename all files that end in _test.rb to end in _spec.rb instead. It's something I've never quite figured out how to do with bash so this time I thought ...
3
votes
5answers
3k views

find command + enable Exit status to be diff then 0 when not match

when I perform find /tmp -name something find command not find the something word under /tmp echo $? I get $?=0 it's OK but how to enable Exit status diff then 0 when find command not ...
0
votes
2answers
311 views

rename files and dirs under linux

why the following command " find / -name 'node1' -print0 | xargs -0 rename 's/node1/node_STAR/' " not replace the node1 under /var/tmp directory? my target is to scan linux sys and rename ...