search for files in a directory hierarchy

learn more… | top users | synonyms

0
votes
2answers
45 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 ...
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
45 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 ...
0
votes
2answers
68 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 ...
2
votes
3answers
108 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 ...
0
votes
2answers
70 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
86 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 ...
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 ...
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
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... ...
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 ...
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 ...
1
vote
2answers
388 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 ...
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
372 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
188 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
142 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 ...
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?
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 ...
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 ...
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
3answers
377 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 ...
0
votes
2answers
572 views

finding files on linux in non hidden directory

In the following command i want to search only only the directories which are non hidden how can i do this using the following command .Iwant to ignore hidden directories while searching the log file ...
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 ...
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
1answer
131 views

On Unix on could I get a listing of all mp3 files inside a directory containing other directories with their full path?

Someone said to me use the find command but I'm not exactly sure how to do it. Basically I need this: suppose I have a folder called dir1 and it contains three sub-directories (dir2, dir3 and dir4 ...
0
votes
1answer
214 views

rsync files created or modified from windows share on cifs mount

I want to rsync the files to my local linux box, but I only want files that have been created or modified within the past 30 days. I'm mounting a windows share from linux using this command: mount ...
2
votes
1answer
123 views

Recursively search and replace the contents of multiple file types

I have thousands of web files(*.php, *.htm, *.html, etc) that contain an absolute path(http://site.com/sites/etc). I need to scan a directory and all subdirectories for the various file types and ...
4
votes
2answers
638 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 ...
3
votes
1answer
278 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 ...
0
votes
3answers
88 views

Find everything installed since server creation

I often seem to be dealing with "almost virgin" Linux installations: VMs that were created for a purpose, used briefly, but after a while we're not sure exactly what's on it. What I'd like to be able ...
1
vote
2answers
1k views

How can I recursively delete old files and prune resulting empty directories?

We're using an AIX server to house thousands and thousands of little files in a nested directory structure. I'm trying to write a script that will recursively delete old files, and then delete the ...
3
votes
1answer
102 views

How to find any symbolic links that point outside a given folder tree?

I have a bunch of folders/files that are 10+ levels deep. How can I find any symbolic links that point outside this folder tree? I tried find -type l but this returns all soft links... even ...
2
votes
5answers
679 views

Remove path from find command output

I have a bash script for deploying code from a beta environment to a production environment but currently I have to add the list of files to a txt file manaully and sometime I miss some. Basically my ...
1
vote
4answers
401 views

Delete old files in large folder

I have a folder which contains many files. I want to delete files older than 30 days, so I use the command: find cache/ -mtime +30 -exec rm {} \; But my SSH session disconnects before the command ...
1
vote
3answers
812 views

how find datacenter using a ip address related to that datacenter?

I have a vds and it's really good! I have some problems with my reseller of that server because of their support. I want to buy a server from that datacenter directly. How can I find that datacenter ...
0
votes
4answers
88 views

find command + exe status diff from 0 when file not found

how to enable find command to print exe status diff from 0 when find command not find the file? according to my example when I try to find the test1.txt file , $? set to 0 but I expect to get value ...
1
vote
5answers
536 views

What is the correct find -exec syntax

I wanted to delete files that were greater than 2MB within a specific folder. So I ran: find . -size +2M And I got a list of two files ./a/b/c/file1 ./a/f/g/file2 So I then run: find . ...

1 2 3 4