search for files in a directory hierarchy

learn more… | top users | synonyms

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 ...
2
votes
5answers
1k 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
835 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
69 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
3k 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 ...
4
votes
5answers
6k 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
319 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
758 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
329 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
1k 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 ...
5
votes
4answers
11k 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
195 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
3
votes
2answers
13k 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
2k 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
818 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
496 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
3k 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 ...
14
votes
4answers
4k views

A better unix find with parallel processing?

The unix find(1) utility is very useful allowing me to perform an action on many files that match certain specifications, e.g. find /dump -type f -name '*.xml' -exec java -jar ProcessFile.jar {} \; ...
0
votes
2answers
167 views

Copying files (of a particular extension) remotely onto local computer preserving paths

I have bunch of files on the remote server. I'm not interested in most of them, except for .pl files. I want to get a copy of these on my local computer. What is the best way to do this (at the ...
2
votes
1answer
25k views

How to search in centos or linux

I have found that sometime i can find files using locate but sometimes it dont find. Which directories it find the file using locate or find Suppose i want to find the files or directories having ...
1
vote
2answers
213 views

Multiple command executions from find

Most people are familiar with using find to run the same command on a number of files, e.g.: find -type f | xargs command or find -type f -exec command {} \; My question is whether it's possible ...
0
votes
1answer
486 views

List all files without 775 or 777 permissions

How can I list all files without 777 or 775 file permissions?
1
vote
3answers
4k views

find command no such file or directory error

I am using this command to delete the files and folders older than 150 days find /media/Server/VPS/dailySQL/* -mtime +140 -exec rm -rf {} \; The problem is that i get the error like below find: ...
0
votes
3answers
734 views

Linux: exclude specific file types when running “locate”

I'd like to configure locate to always exclude specific file types. For example, I would like to exclude ".pyc" ".class" "~" etc.
7
votes
1answer
6k views

Get all extensions and their respective file count in a directory

Getting all extensions for a directory: easy. Getting file counts for a particular extension: easy. But getting all file extensions and their respective file counts is alluding me. eg. + dir + ...
0
votes
2answers
184 views

File name using find

How to get the file name while using find command? When I use find command to search particular type of files from a directory and subdirectories, I get the whole path of that file, how do I get the ...
9
votes
2answers
4k views

find command default sorting order

what is the default sorting order for entries returned by the linux find command? For example, if I issue find . -type f -name '*mp3' and the output consists of multiple files across multiple ...
5
votes
7answers
2k views

Linux Colorize Find?

Is it possible to 'colorize' the output from find? I have a find that searches /home on all of my servers, and exec 'rm' certain files. As these are mixed in with my other find results, among ...
2
votes
3answers
521 views

How to use find to replace several files of the same name

I have several files of the same name (say, somefile.php) scattered within several directories under /var/ If I want to replace all of them with a new version of somefile.php located in, say, ...
1
vote
3answers
3k views

mass mv using find?

there are a bunch of filename.gif scattered in /home/ directories. I want all the filename.gif replaced by a /home/shared/filename_default.gif. I tried something like find /home/ -name ...
1
vote
3answers
304 views

Find in files, Linux

Say I want to find all files that mention "Jonathan Appleseed" in a Linux system. I see examples using grep, but I can't quite grep yet how to search (all directories from HERE). So I want to look ...
1
vote
2answers
564 views

Linux shell script: delete all files without “01” in the name

I have a backup script that creates files named for the day of creation in the format backups_YYYYMMDD.tar.gz I currently purge everything over 30 days old with a command like this: find /backups ...
2
votes
4answers
2k views

How to remove directory on NFS fileystem with an enormous number of files

A poorly tested program created a directory on an NFS share with an enormous number of files, which I need to remove. ls -ald /home/foo drwxrwxr-x 2 503 503 317582336 Jul 29 11:38 /home/foo The ...
1
vote
3answers
2k views

How to delete everything except .svn directories?

I have quite complex directory tree. There are many subdirectories, in those subdirectories beside other files and directories are ".svn" directories. Now, under linux I want to delete all files and ...
5
votes
4answers
2k views

find only files in directory with permissions not set to 644 on linux

This is my first question although I've been lurking for a while. Question: I would like to use find to get only the files in a directory with permissions not set to 644 (or another permission ...
6
votes
3answers
408 views

Using `find` to delete

So, given three options... find .... -delete find .... | xargs rm ... find .... -exec rm ...; ..or variations thereof, which option is preferable? I'm guessing there is no hard and fast ...
2
votes
3answers
1k views

How do I find the total number of lines in a set of found files (using Linux command-line tools)?

I can find the number of lines of each file matching a particular pattern using (for example): $ find . -name "test.save*" -exec wc -l {} \; 673000 ./test.save8.txt 24000 ./from/test1/test.save3.txt ...
3
votes
3answers
6k views

Why does FIND on Windows 7 give an “Access Denied” error?

I have an administrator account on a Windows 7 x64 machine. It is not THE administrator account, the account is simply a member of the administrators group. The install is default. When the user ...
4
votes
1answer
14k views

How to view hidden files using Linux `find` command

On a Linux server, I need to find all files with a certain file extension in the current directory and all sub-directories. Previously, I have always using the following command: find . -type f | ...
0
votes
1answer
512 views

Untar multiple files in different directories

am trying to perform an update on multiple site that use an open source CMS but untaring a patch file in each sites httpdocs directory. My plan was to perform a find for the patch file then untar ...
0
votes
3answers
549 views

Scripts help FIND command via atime output to multiple files

here is a script I have wrote that I need help with. in the script I do a find for any file that has not been access for over 30 days, 60, 90, 180, 270 & 365 days. This works just fine. however, ...
5
votes
2answers
3k views

find files NOT belonging to group

How do I find files not belonging to particular group? find /home -group NOT test
2
votes
3answers
397 views

List all symbolic links on a directory

a short question: is it possible to list all symbolic links onto a directory other than running a find over the whole filesystem? Background: I have a directory containing a lot of different versions ...
1
vote
2answers
364 views

What's a simple way to list the immediate subdirectories of a given location?

Is there a built-in command or a less verbose way of achieving this? find /var/foo -maxdepth 1 -mindepth 1 -type d Or should I just make a tiny shell script or function if I'm doing this sort of ...
2
votes
2answers
453 views

Bash script to create mass series of directories

I need to create a Bash script to go into every user's home folder, seek out a wp-content folder, create a directory uploads under it, and then chmod 0756 uploads. How do I achieve this? I imagine I ...
10
votes
7answers
23k views

Linux: using find to locate files older than <date>

find has good support for finding files the more modified less than X days ago, but how can I use find to locate all files modified after a certain date? I can't find anything in the find man page to ...
3
votes
4answers
1k views

Find directories that do not contain a directory?

I'm trying to figure out how to use the linux "find" command (or another command that will get the job done) to return a list of file paths/directories that do not contain a directory of a certain ...
4
votes
1answer
218 views

Linux command to find all *.rb files

I still can't figure out how to use the Linux find command. I'm trying to find all the .rb files under the /var/www directory. What's the correct command to type in Bash?