search for files in a directory hierarchy

learn more… | top users | synonyms

5
votes
3answers
2k 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
155 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
18k 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
198 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
342 views

List all files without 775 or 777 permissions

How can I list all files without 777 or 775 file permissions?
1
vote
3answers
3k 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
463 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.
3
votes
1answer
3k 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
175 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 ...
6
votes
2answers
2k 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 ...
4
votes
6answers
1k 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
245 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
287 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
546 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
1k 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
1k 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
315 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
759 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 ...
2
votes
3answers
3k 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 ...
3
votes
1answer
8k 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
427 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
495 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, ...
2
votes
2answers
1k 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
394 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
190 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
417 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 ...
9
votes
7answers
12k 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
179 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?
2
votes
1answer
273 views

Find only top directories matching search

I'm trying to find all the web folders that are 777. But I only want a list of the top folders. So if there is an img dir that has folders in it that are also 777 I don't want them returned. ...
3
votes
3answers
3k views

Linux - A more fine grained -mtime for find?

find is a great tool for finding files. It has the option to find files that were modified in the last X days with -mtime. However I'd like something more fine grained than that. I want to be able to ...
3
votes
3answers
795 views

help with bash script using find and diff command

i have a bash script that i need help with: #!/bin/bash if [ -f "/suid.old" ] then find / -perm -4000 -o -perm -2000 ls > suid.old else find / -perm 4000 -o -perm -2000 ls > suid.new diff ...
1
vote
2answers
428 views

find only files with certain prefix

I'm trying to merge my CSS files the following way: find /Applications/MAMP/htdocs/css/ -type f -name "*.css" -exec cat {} + > ./temporary/css_backend_merged.css That works great, but I want to ...
1
vote
1answer
397 views

Unwanted ._ files showing up from an SMB share

At work, we all use Macs, and have an SMB fileserver set up. Somehow, weird hidden files have been popping up, particularly when syncing between our Macs and the fileserver. I don't what creates them ...
0
votes
2answers
373 views

du, find and load average

I have a complex directory structure with lot of small files in it. like: /opt/data/1000/45/32/2009/10/15/76543.zip When I launch a "du" or "find" on this directory (/opt/data/) my server load ...
2
votes
2answers
2k views

How do I make (non-gnu-)grep ignore binary files?

Hey, I am on a HP-UX server here. When recursively grepping a directory tree, I have problems when the tree also contains binary files: grep treats them as text files and displays very long lines ...
0
votes
2answers
1k views

find files modified in an interval on unix

I am on linux and have tried to figure out the find command for a while to be able to list the directories modified in a 24 hour period a certain number of days ago, but I can't get it to work. Among ...
1
vote
3answers
242 views

find . -name “foo” | more doesn't work

I'm a unix newb. I'm using find, but I'm getting too many results to fit on my screen since it's listing the permissions denied folders. I've tried piping it to more but that doesn't seem to have any ...
3
votes
2answers
3k views

Why does this regex not work on linux?

prescript: I am not sure where this question belongs i cant say it works on windows but from my understanding this regex is correct and how i would write it (except maybe the ^ at the beginning) ...
14
votes
4answers
9k views

Shell Scripting: Using find to delete files matching a pattern

I'm trying to write a bash command that will delete all files matching a specific pattern - in this case, it's all of the old vmware log files that have built up. I've tried this command: find . ...
3
votes
2answers
285 views

What does rm {} + do?

As in find -L /etc/ssl/certs/ -type l -exec rm {} + So it finds all broken symlinks and deletes them. But how exactly do I interpret the {} + part?
2
votes
4answers
3k views

Use 'find' to determine files modified yesterday

I'm sure this is an age old question with a simple answer, but I've tried every combination I know to try and haven't come up with anything. And searching Google is less than pleasant since searching ...
9
votes
3answers
176 views

Find's -true option: what for?

GNU find (and others?) has a -true test along with the normal -name, -mode, -user and so on. From the man page: -true Always true. Every time I see the man page I notice this and wonder when ...
3
votes
5answers
323 views

Deleting files in Linux

I need to find all files matching a certain criteria and delete them - here's a snippet: /var/www/somesite/releases/{many directories}/tmp/attachment_fu I'd like to find all files in any ...
0
votes
4answers
471 views

Subversion Path on Ubuntu Server

Might be a dumb question. But I installed SVN 1.4.6 via apt-get. Everythings working dandy with no issues. I want to backup all the SVN files so I figured to backup /svn which is where appache is ...
6
votes
3answers
3k views

Unix magic, delete all .pyc files from a tree of directories?

Is there a quick way of deleting all the .pyc files from a tree of directories?
6
votes
3answers
7k views

how to find files with incorrect permissions on unix?

I'm looking for a way to search a directory or directories and list all the files that have the wrong permissions for a public directory.
4
votes
2answers
4k views

How to count all subfolders in an directory?

How can I count how many folders (including subfolders) I have under an specific folder?