search for files in a directory hierarchy
1
vote
3answers
1k 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 ...
0
votes
2answers
44 views
Move files to another directory which are older than a date
I am looking for a solution to move files that are year older from today. My log partition is getting full, but I can not remove them. They are needed for a long long time. Anyway one solution I came ...
3
votes
1answer
275 views
how to list files that are NOT open using find command
I want to "list" all the files that are NOT open, within a certain directory using the GNU find command. Now, I am able to list the files that are open, but can't figure out a way to do the inverse of ...
2
votes
2answers
59 views
How do i use the {} operator in find execution inside exec
I tried this bash command:
find /var/www/ -path '*wp-admin/index.php' -exec mv {} $(dirname {})/index_disabled
But the second {} is not executed.
It results in just ./index_disabled instead.
How ...
0
votes
1answer
42 views
Recursively delete empty folders with verbose output
This should be fairly simple, but I am not sure what i'm missing.
I'd like to recursively delete empty directories, and get an output for what's being deleted, this command works for sure, but I just ...
6
votes
6answers
7k views
How do I find all files and directories writable by a specific user?
Under Linux, how can I find all the files and directories that are writable (or, actually, not writable) by a particular user?
Edit: To clarify, I meant under a particular subdir, not systemwide. ...
13
votes
5answers
22k views
How do I find (or exclude) all directories and sub-directories matching a certain pattern (in Linux)?
I'm trying to use the Linux find command to find all directories and sub-directories that do not have .svn (Subversion hidden folders) in their path. I can only get it to exclude the actual .svn ...
9
votes
3answers
2k 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 ...
2
votes
4answers
491 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 ...
0
votes
2answers
67 views
Linux Find and Zip Files
I'm running into 2 problems when working with my logs and the find command.
I am having problems with the mtime option. The 1st command below shows me a few files from March 5th till March 7th, like ...
2
votes
1answer
53 views
RSYNC Slow / Copy only changed files?
I have a server that maintains thousands of log files that are nested in thousands of directories. At the moment, I am using RSYNC to copy those log files to a web server where I parse them and make ...
1
vote
1answer
51 views
find … -exec command not executing on all files found
How come this command:
find . -name \*.css -o -name \*.php -type f
gives me a list of all the *.css and *.php files BUT adding the 'exec' option:
find . -name \*.css -o -name \*.php -type f -exec ...
0
votes
0answers
29 views
Can slocate include file sizes?
I want to get a list of the large files on my system but I don't want to have to run the find command to produce this year.
Can the slocate command be used to include file size information? I don't ...
1
vote
5answers
629 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 ...
2
votes
3answers
107 views
find and remove duplicates filenames in directory hierarchy
#!/bin/sh
LASTBASE=""
find $1 -type f -print | rev | sort | rev | while read FILE
do
BASE=$(basename "$FILE")
if [ "$BASE" = "$LASTBASE" ]; then
rm "$FILE"
LASTBASE="$BASE"
done
...
5
votes
3answers
5k 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.
0
votes
2answers
68 views
centos - how to find a filename with all the possible extensions?
I need to perform a search for "foo" and return all the filenames/ directories with this name (e.g. foo.php, foo.txt etc ). It should run through the whole filesystem and find even hidden files .
...
2
votes
2answers
84 views
Running a script containing find with a regexp fails in cron but works in a shell
I have the following script in my /etc/cron.d:
19 15 * * * root /opt/scripts/clean-nexus-release-repo.sh
The clean-nexus-release-repo.sh script looks like this:
#!/bin/bash
find ...
2
votes
2answers
42 views
-links option in find command
Please explain me what is use of -links option in find command. The man page is not giving much information. Some of our scripts we are using have an option -links 0 in find command.
I am using the ...
4
votes
5answers
136 views
Get Size of All Folders in Directory
I want to get the size of all directories within a specific directory. I was thinking something like
find . -type d -exec du -sh {} \;
But that returns all directories recursively. How can I limit ...
0
votes
1answer
75 views
How to find any file that is an executable or library
Let's say someone provides you with a tarball, saying it is source code and nothing else. You want to make sure that is true, and that no virus-laden executables or libraries are tucked away in a ...
0
votes
1answer
95 views
finding directories that consume a lot of the AFS volume quota
The AFS volume quota is almost exceeded for one of our computer users. Running fs listquota or fs lq gives him a warning:
olifri@ubuntu:~$ fs listquota ~
Volume Name Quota ...
2
votes
1answer
53 views
finding files that match a precise size: a multiple of 4096 bytes
I have several drupal sites running on my local machine with WAMP installed (apache 2.2.17, php 5.3.4, and mysql 5.1.53). Whenever I try to visit the administrative page, the php process seems to ...
15
votes
7answers
23k 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 ...
7
votes
4answers
875 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. ...
1
vote
2answers
59 views
How to use `list` to locate attributes changed to `s---ia-------`?
My linux CentOS server has been compromised lately (rootkit). Some files attributes have been changed, for example the command :
lsattr /bin/ls
gives
s---ia------- /bin/ls
How cand I use find ...
4
votes
2answers
636 views
FreeBSD: How to know real file size on zfs with compression on?
I'm using zfs on my FreeBSD 9.0 x64 and pretty happy with it, but I find it hard to count directory real, not compressed, size.
Surely I can walk over the directory and count every file size with ...
4
votes
2answers
1k views
Postfix “warning: cannot get RSA private key from file”
I just followed this tutorial to set up a postfix mailserver with dovecot and mysql as backend for virtual users.
Now I got the most parts working, I can connect to pop3 pop3s imap and imaps.
Using
...
1
vote
2answers
51 views
Using find to locate files modified in Aug
I need to find files modified in August. Here's my portion of the command that narrows down the modification time. This works, but it seems to be missing some files. I'm guessing this is missing ...
1
vote
3answers
71 views
Linux single find command within thousands of directories [closed]
I have to search through about 7,000 directories and determine the number of PDFs modified last month grouped by the type of PDF, which is in a MySQL database. The folder structure is...
...
7
votes
6answers
8k 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 ...
0
votes
4answers
68 views
Linux Find to delete files in folders
the goal is to find directories with given name and delete all files inside them, keeping actual directories
find /home/www/sites/ -iname '_cache' -exec du -hs {} \;
this gives me a list of files ...
2
votes
1answer
3k 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 ...
1
vote
1answer
362 views
How can I use netsh to find a rule using a pattern
I'm wondering whether anyone in Microsoft has ever come to a situation where they can't remember a rule's name!
The netsh advfirewall firewall show rule only accepts 1 name and no pattern matching ...
0
votes
4answers
109 views
is there an 'upwards' find?
To find files starting from a certain path, I can use find <path> .... If I want to find 'upwards', i.e. in the parent directory, and it's parent, and..., is there an equivalent tool?
Intended ...
0
votes
5answers
169 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. ...
4
votes
1answer
43 views
Glob Not Match?
How to list files that don't match a glob?
E.g., let's say I have a directory that contains hundreds of files, 97% of which have the filename extension .png.
I know I can list the PNG files with:
...
0
votes
4answers
143 views
Calculate disk space occupied by many .png files
I have 357 .png files located in different sub dirs of the current dir:
settings# find . -name \*.png |wc -l
357
settings# find . -name \*.png | head
./assets/authenticationIcons/audio.png
...
3
votes
4answers
370 views
How to do a for loop of filenames with spaces using find
I have the following script - its supposed to loop files names using find but it seams to break the files names up by a space? I need the file names to remain intact
#!/bin/bash
for file in `find ...
5
votes
2answers
224 views
Does “find” open files?
I recently issued this command:
find . -type f | wc -l
To count how many files are in my public_html folder.
Shortly after, Nginx returned 500 internal server error and error.log was being flooded ...
0
votes
0answers
187 views
find gpo's in gpresult (for in do / findstr / find)
I wan't some specific rules for different gpo's, if I use: "gpresult /r /scope user" I get to see which GPO's (security groups) are active. Now how can I filter some of these active GPO's to my batch ...
2
votes
3answers
138 views
find count of images within a directory
I wanted to find the number of image files within a directory. I ended up using this :
find . -type f -exec file {} \; | grep -c -i 'image'
This feels like an inefficient way of doing it. I could ...
2
votes
2answers
58 views
How do I detect the version of find on OSX
I need to detect which version of the find command is used from a shell script. GNU find supports the --version argument but the find command on OSX apparently does not support that. Is there a way to ...
1
vote
2answers
67 views
linux or solaris match files with uniq syntax
how to match all files that start with the string OS_PATCH
and ended with .gz
remark - the solution must to fit Linux and Solaris OS
this task could be by find command or maybe with ls with ...
5
votes
5answers
186 views
How to find all filenames with given extension
I need to find all .pem files on my system. Would the following do this?
sudo find / -type f -name *.pem
If not, how would I write a find command to find every file of the sort?
5
votes
4answers
1k views
How to tell if a file is older than 30 minutes on AIX?
I'd like to write a shell script in ksh or bash which exits with 1 if a specific file is older than 30 minutes. (Last modification time is older than half hour).
It would be easy on a Linux or a ...
2
votes
4answers
194 views
find executables
The following command works on Ubuntu (GNU findutils 4.4.2) but not on Fedora (4.2.27)
time find . -maxdepth 1 -type f -executable -print
How do I find executable files using older version of find?
...
0
votes
2answers
45 views
find files without any extension
How do I find the files those do not have an extension? For e.g. in the following screen, I will like to return the file sconnect and not .xls
-rwxr-xr-x 1 root root 12K Mar 7 19:29 ...
0
votes
3answers
365 views
On linux how can make a list of files that are owned by a particular owner and then fix the group and owner?
I have a deep and complex file system where some files have been accidently written by root. I want to change the ownership of those files back to the original owner in one go.
I am playing with ...
3
votes
4answers
112 views
`find` command not available in web host, how to implement a delete based on modification time using other commands?
I'm creating a simple datebase backup solution for a client using web hosting at DataFlame.
The web hosting account provides access to cron but not a shell.
I have a database backup script creating ...

