search for files in a directory hierarchy

learn more… | top users | synonyms

1
vote
1answer
24 views

Identifying files being actively written to CIFS share

Is there a way to identify files that are actively being written to a CIFS mount in Linux? I am interested in skipping those files. My first thought would be to fine tune the find command with ...
0
votes
1answer
14 views

Source of long running find process on server

I'm wondering where a long running find process on my ubuntu linux server (14.04 LTS) came from and what the meaning of it is. Here is the output of ps: 16915 ? SN 32:41 /usr/bin/find /tmp ...
-1
votes
2answers
27 views

Find all files which contain pattern in directory of tar files

I have all tar files in a directory. I want to find some files in tar files without extract all tar files. I know how to work with one tar file: tar tvf abc.tar | grep xyz I want to find in all tar ...
1
vote
4answers
53 views

How to find directory containing specific files or directories?

I'm looking for a one-line command that find multiple files or directories contained by a single directory. foo -> bar -> baz -> quux temp -> bar I'm looking to only find foo ...
-1
votes
1answer
53 views

Using rsync with StrictHostKeyChecking and find files older than 5 minutes from remote

I would like to use rsync to sync my files from remote to a local directory. Therefor I use StrictHostKeyChecking so that there's no need to enter a password. Now I would like to only sync files ...
0
votes
1answer
74 views

Command find show “Value too large for defined data type”

When I run the "find" command in any folder, works perfect, but only in a particular folder I get this: root#find . find:.: Value too large for defined data type It is a shared folder from another ...
7
votes
1answer
157 views

File is too big for /dev/null

While testing a problem LUN for read errors, I encountered the following problem: find /mnt/problem_lun/ -type f -print -exec dd if={} of=/dev/null bs=8k \; ... /mnt/problem_lun/a_file dd: writing ...
1
vote
1answer
166 views

Linux find: How to exclude the “.snapshot” directory from find's results?

I wrote a rsync script which uses find command to find all files which are older than 10 minutes and copies them to a remote server. The relevant part of the code is: print_log "------ Starting $0 ...
1
vote
1answer
39 views

Running “find” and piping the output to “wc”/“sort”, inside an outer “find -exec”

I've a folder used by imapsync to store its own cache. Such a folder contains a subfolder for each of the mailbox I'm syncing, and nothing more: [dv@monitor] find * -maxdepth 0 -type d | wc -l 126 ...
0
votes
1answer
28 views

Searching for files containing text (not string) in bash

How do I find files containing some particular text containing newlines and plenty of other charachters all sorts of quotes and backslashes using terminal?
0
votes
4answers
119 views

How do I delete the contents of a directory if there are spaces in the path?

find -name "lastStable" -o -name "lastSuccessful" -exec sh -c "sudo rm -rv {}/*" {} \; As you can see from the above command, I am going through and deleting the contents of the lastStable and ...
0
votes
1answer
22 views

Bash find file with specific permission for group, no matter permission for user and others

Using only octal notation, I need to find file that have only read permissions for group, no matter which owner and other permission are. Which is the right command? I can't find it. Thank you.
1
vote
4answers
92 views

find command with parameters in variable

> find /etc -name 'shells' /etc/shells # good !! > SEARCH="-name 'shells'"; find /etc $SEARCH # nothing found - bad !! Why "find" command can't take params in variable? Other commands ...
0
votes
1answer
40 views

find files which are not currently in use

I'm trying to archive some older files, but don't want to touch all the files which are currently in use. What's the best way to ask find to exclude "in use" files? Right now I'm working on this ...
0
votes
1answer
115 views

is it possible to search only a files that have specific extended attributes set?

is it possible to search file in the linux OS that have particular extended attribute as this: ---S--l--- ---S--l--- 1 root root 0 Mar 1004:25/opt/csTuner/iba/wys/tuer_lolk What is S ...
0
votes
2answers
469 views

Invalid argument when running 'find' command with -exec and -mtime

Pretty wierd error message came up on Centos. I tried to run this command: find /tmp/something -type f -mtime +2h -exec cp '{}' /tmp/target \; And the error I've got: find: invalid argument ...
0
votes
1answer
32 views

Grep a textfile with (find generated) files, but ignore paths

I receive a huge textfile generated with find. The contents of the generated textfile are a file-referenes with full path, i.e.: //server/dir1/dir1foobar.ext //server/dir1/dir2/dir1bar.ext ...
1
vote
1answer
136 views

Windows findstr with AND condition?

Is it possible, in one line, without a batch file to use findstr and only return a 0 %errorlevel% if all of the strings are found? I am doing a gem list, which lists out a bunch of gems. I then want ...
2
votes
1answer
115 views

Linux: How can I get a different exit code from the find command if no files matching the pattern I used are found? [duplicate]

I have a script which runs the next command: find /storage2/hpfiles_staging/ -name \*.gz -mmin +600 And then rsync's the files to a remote location. Sometimes the find command returns no output ...
4
votes
1answer
95 views

Look on all server desktops for outstanding files before deleting profiles

We have about 70 servers that we are in the process of moving into a domain environment, so we are converting our users from local accounts to domain controlled accounts. How can we determine which ...
1
vote
1answer
69 views

Finding strings in files with relative path

I don't understand why this two commands don't provide the same result (the differrence is only relative vs. absolute path), can somebody explain it? annika /srv/www/pages/com.example.www/www/povruc ...
0
votes
1answer
67 views

cygwin find -ls behaviour like ls [closed]

I use cygwin find with -ls (find . -ls) option to have a list of files with full path. Due to UTF-16 (windows XP in this case) converted to en_UTF-8 under cygwin, special charactere like accent are ...
1
vote
1answer
39 views

Why is find not excluding old files?

I want to copy all gzipped files from my apache logs that were created less than 43 days ago. As a test, I simply listed my files from find: sudo find /var/log/apache2/ -mindepth 1 -ctime -43 -name ...
2
votes
2answers
214 views

Running “find” command generates high load

I run this command on a Debian server with SSD drives configured as RAID 1: ionice -c 3 find . -type f -amin -1440 -mmin +1441 -not -path custom/ -print0 on a path which contains over 1.7M files and ...
3
votes
2answers
345 views

Why is my find -type d performing fstat on every file in a folder?

I'm running find . -type d on a rather large directory tree. I am only interested in finding directories within this tree, but when I ran an strace against the process to make sure it was doing what I ...
0
votes
2answers
83 views

Using find to exclude a directory and tar up everything else in a directory

I have following in a directory: dir1 dir2 file1 file2 I want to tar up everything except dir1 When I do: find . -path '*dir1*' -prune -o -print I don't see dir1 in the output ( as expected) ...
3
votes
1answer
100 views

List directories not containing a file which has a variable prefix

I'm checking the output from a script. In some cases the script has failed, and a certain file hasn't been produced. I want to check whether this file is present in a directory and if not, print the ...
2
votes
5answers
991 views

how to find mysql binary in redhat

I am working with a Redhat distribution. The network admin is inaccessible so I have no ability to request information. Using bash, how do I find the mysql binary so that I can run sql commands? ...
0
votes
2answers
174 views

find and replace multiple files using a file as input to find and another to replace

I need to replace several chunks of text inside some php scripts... i have: find . -name 'products.php' -exec grep --silent 'TEXT_TO_FIND' {} \; -exec ls {} \; -exec sed -i ...
0
votes
1answer
55 views

linux + mount from local dir [closed]

in my Linux machine I run the following command under from /usr/cti/APPS directory cd /usr/cti/APPS mount -t nfs $server:$target_dir /mnt I want to show something very interesting I can run ...
1
vote
1answer
2k views

/bin/sh: /bin/cp: Argument list too long

I have problem with this command: 'cp' -fr /www/*-aws/* /www/mainhost/aws/awstatstotals/tmp/ Error is Argument list too long - I know many /www/-aws/ folders. I know that I can use FIND command, ...
1
vote
3answers
671 views

linux: find files from a list in txt, the files contain spaces

I need to find files from a list in txt (i already have the txt with all the files, are separated with lines), the files contain spaces and the extension of the files are pdf, if you can suggest how ...
0
votes
3answers
173 views

How can I copy all files in one tree to another tree except those matching a pattern?

I have a directory tree under ./src/ I have another matching directory tree under ./work/ I'm trying to copy all the files in src to work, while keeping the directory structure and excluding all ...
0
votes
2answers
358 views

Bash/grep: ignore lines over N characters

I have a find/grep command that i use to search my projects' codebase, thus: find folder1 folder2 folderetc -print | awk '{print "\""$0"\""}' | xargs grep -n "search-string" Something that ...
0
votes
1answer
845 views

Cannot find home directory on Linux Server

I have recently been granted access to a Linux server where I transferred some data. Now, for some reason, when I use WinSCP or any other program to connect to the server, instead of logging in ...
0
votes
2answers
986 views

Find, chown and exclude directories

I would like to change the ownership of all files and directories but exclude some directories: find -user test ! -path "./dir1/*" ! -path "./dir2/*" -exec chown -R root:root {} \; The ownership of ...
0
votes
2answers
149 views

I accidently gave all my project files a .gz format, how to revert it?

So I've accidently gave all my files, php, js, html, css files a .gz ending, so they look like: .bowerrc.gz index.php.gz main.css.gz etc... Using Centos 6.4, how can I revert back all the files? ...
0
votes
3answers
968 views

Exclude with the find command [duplicate]

I need some help getting the find command to work right in a script working on. I need to be able to exclude some directories. Below I have what I'm doing as a work around. sudo find / ( -name ...
2
votes
1answer
1k views

How can i manipulate the find command to “find” the directories the “found” file is in?

So i'm trying to use the find command to find all files in my system with mtime -x. It does this but it does not "find" the directories of the file. find . -mtime -2 -exec rsync -av {} /destination/ ...
0
votes
3answers
1k views

How to delete file by access time in linux? [closed]

I want to delete *.mp3 files that access time is older from 10 minutes in a directory. How can i do? Thanks.
1
vote
1answer
32 views

How to get a debug output from the find command?

I have the following find command: find /home/ -type d -name "something" what I want to achieve is to know which directory/file is checked by the find command no matter the fact that it does or ...
0
votes
1answer
252 views

Find and rename files removing suffix

I'm using the following command to move all files (non-recursively) ended in _128.jpg into the 128x160 subdir. This works great. find . -iname '*_128.jpg' | xargs -I '{}' mv {} 128x160 But I also ...
2
votes
2answers
1k views

linux command line find escape question mark

For some reason I would like to delete all files names like "*.jpg?" (the filename is ending with a real ?) I tried this find /var/www/ -type f -name "*.jpg\?" and find /var/www/ -type f -name ...
1
vote
0answers
184 views

Composer runtime error when deleting subdirectories

I am running 'composer install' on my server, and then using the script feature to delete all subdirectories called '.git' but I am running in the following composer error. Delete all .git dirs find: ...
1
vote
1answer
198 views

Find and replace files in linux

I know how to find and replace certain string through files, but I'm interested how could I find and replace whole files? e.g. I would like to find all info.php files that were modified at specific ...
1
vote
0answers
60 views

Clarifying what modifies atime and the impact the find command might have

So on a regular basis I clear out files from my server which have an atime +160 with a command such as: (technically to delete old files but avoid any file that might have been accessed recently) ...
1
vote
1answer
94 views

Results of not using '{}' in find /mnt/tmp -atime +91 -exec rm -f {} \;?

I have been using the following code for the longest on a system I took over: find /mnt/tmp -atime +91 -exec rm -f {} \; However, researching further I see everyone saying the curly braces should ...
0
votes
1answer
2k views

find directories in the current directory, older than 5 days and archive them

This is basic questions. I need to find folders in the current working directory(not recursively) and if they are older than 5 days archive them. zip or tar.gz is fine. I can find the folders with ...
0
votes
1answer
421 views

Unix 'find' command to include/exclude subdirectories

Say the folder structure looks like this: . |--folder1 |--subfolder1 |--subfolder2 |--subfolder2 |--folder2 |--subfolder1 |--subfolder2 |--subfolder2 |--folder3 ...
1
vote
1answer
75 views

How to find non-ports installations in FreeBSD?

Is there way to find all non-ports installations in FreeBSD? I'm using 8.4 version. Update: I need this for audit installed binaries for system "trusted" versions.