search for files in a directory hierarchy

learn more… | top users | synonyms

2
votes
2answers
971 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 ...
0
votes
2answers
384 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
54 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
245 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
42 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
242 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
235 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
222 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
61 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
3k 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 ...
4
votes
1answer
4k 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
565 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
707 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
428 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
451 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
110 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
311 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
10k 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
250 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
4answers
591 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
927 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
335 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
2k 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 ...
21
votes
8answers
39k 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
369 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
87 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
71 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
301 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
620 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 ...
13
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
667 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
723 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
678 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
63 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
1k 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 ...
2
votes
5answers
2k 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
305 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 ...
0
votes
4answers
700 views

directory with 980MB meta data, millions of files, how to delete it? (ext3) [duplicate]

Possible Duplicate: rm on a directory with millions of files Hello, So I'm stuck with this directory: drwxrwxrwx 2 dan users 980M 2010-12-22 18:38 sessions2 The directories contents is ...
3
votes
1answer
275 views

List directories without a specific folder

I need some help constructing a directory listing using 'find'? An example directory structure looks something like this: / (root) - /foo - /folderA - /folderB - /bar - /folderA ...
1
vote
3answers
811 views

chmod of 400,000 files inside multiple subdirectories?

Howdy... I'm looking to chmod 777 a whole bunch of files. Alternatively, since it's more secure, I could also settle for a chown www:www of these files to make them web accessible. Now, since I have ...
4
votes
4answers
9k views

“find -mtime” does not work as expected on files with different timezones?

I have some files on server with the date several months ago, but invisible for find -mtime 7 search. When I list them as ls -l they look perfectly normal -rw-r--r-- 1 root root 347253 Jun 12 ...
0
votes
2answers
188 views

Search multiple strings from multiple files

How to search multiple strings from multiple files with a single command. May be using grep or find or if there is any other in Linux or Solaris
2
votes
2answers
7k views

rsync only files created or modified after a date and time

The goal is to rsync (or using any other tools that give the desired result) only files that are created or modified after a date. It should work with filenames containing spaces (and/or other ...
0
votes
3answers
1k views

exclude all hidden files and directories in solaris

Unix newbie could use your help. I'm using Solaris 10 and need to find all files, excluding all hidden files and directories. The ultimate goal is to put this in a script that will delete files 60+ ...
1
vote
1answer
573 views

rsync and find files edited in last day

using rsync to do daily backups of our databases but i don't want to mirror the original every days and just download the files that have changed. this is nearly there but when there's one match in ...
0
votes
1answer
398 views

Finding/deleting top level folders not containing any files

I want to delete the top level directory which does not contain any files, but can contain other empty (meaning again not containing files) directories. For example: $ ls -R .: foo/ ./foo/: bar bar1 ...
8
votes
2answers
2k views

Linux & SVN: How to remove all versioned files but KEEP directory structure, ignore .svn dirs?

I want to remove all the versioned files from my repository, but KEEP the versioned directory structure. Obviously I want to leave all the .svn directories untouched. In other words, I want to ...