Programming :: Excluding Files From Find?

Oct 22, 2010

I have spent the last hour searching for a solution to this, but I can't get it to work. Here is what I am trying to do:

I have directories for different months in one folder. So for example Code: ../folder/Jan/
../folder/Aug/
etc. Some of the folders have a dot in front of the month as so: Code: ../folder/.Sep/
../folder/.Oct/

[Code].....

I am trying to find all the csv files EXCEPT those in a folder that has a dot. For example I want all the csv files in ../folder/Jan/ but I want none in ../folder/.Oct/.

I also want to exclude all the files in the /Aug/ folder that represent days 10-31.

Here is what I have so far: Code: find /some_path/folder/ ( ! -name "Aug[10-31]*.csv" ! -path "/.*/" -name "*.csv" ) | more This command lists all the .csv files except those in the /Aug/ files. So it just ignores the /Aug/ folder completely but lists every other .csv file.

View 3 Replies


ADVERTISEMENT

General :: List/find All Regular Files In All Subdirectories Excluding Binary Files

Oct 5, 2010

I know I can do find . -type f, but that includes binary file and I couldn't find a way to exclude them with find

View 4 Replies View Related

General :: Excluding Directories With Find?

Jun 10, 2011

I am trying to exclude 2 directories with find and pass it into cpio. I have tried

Code:
find . -depth -path '.evolution' -prune -o -path '.gconf' -prune -o -print|cpio -aov > /media/caca/full$date
./.gconf/apps/evolution/memos/%gconf.xml
./.gconf/apps/evolution/memos

[Code]....

View 4 Replies View Related

General :: Find Command \ Search File Excluding The NFS?

Jan 20, 2010

I want to search file excluding the NFS ...find / -mount -name 'filename' restricts the search only in the root disc partition,but the file can be in other partitions alsoIs there any way to exclude the NFS only.

View 2 Replies View Related

General :: Zip All The Files Excluding Todays File?

Jun 21, 2011

At present in my server the log folder was filled up and causing memory issue. So I am planning to write a script in such a way that the files which are older than 30 days will be deleted and also need to find the files which were not compressed and need to compress this file. Compression will exclude if the file was created on the same day.

View 12 Replies View Related

Software :: Excluding Directories And Files In Tripwire?

Jul 12, 2010

I have tripwire 2.4.1 up and running on one of our servers, and I am now in the process of configuring it to exclude some files and/or directories that are known to change periodically between integrity checks.

I did some reading on the subject, and one file that came up was the tw.config file. However, when I did a search for the file, there was no instance of it on the server. My next thought was to modify the tw.pol file, and I did try to list some files to be excluded. However, when I tried to update the policy, I got an error message which indicated the syntax that I entered within the tw.pol file was incorrect.

If the tw.config file does not exist, can I create it, and modify the tw.pol file to indicate where the file is located on the server?

View 1 Replies View Related

Programming :: Excluding Directory From Backup In Bash?

Jun 30, 2011

I've got the following code and kludge. It's working okay except that there's a directory called "Archive" which I don't need to backup. I've tried various combinations of &&, -a, etc., and I'm kind of at a loss for getting this right.

Here's the code I have so far:

Code:
#!/bin/sh
# backup subdirs as individual tarballs with prepended timestamps and
# move them somewhere else.
# --exclude "/path/to/dir/*" (Doesn't seem to work)

[Code]...

How can I write that line so that I can loop through all of the subdirs, tarring them up, but excluding the "Archive" subdirectory?

View 6 Replies View Related

Programming :: Command For Find/Replace In Text Files (inc. Files In Sub-folders)?

Oct 11, 2010

I found this command that works great finding and replacing a simple string to another in files located in that folder and all sub-folders.

Code: find . -name '*.php' | xargs perl -pi -e 's/OldText/NewText/g'

The problem I have is that I need to replace a more complex string, like this: Old string: /mnt/stor6-wc2-dfw1/627896/982574/ New string: /mnt/stor8-wc2-dfw1/369587/302589/ There I don't know how to do it... since the / is what separates the old from the new strings, and the strings that I want to replace have / in it. Also, I would like to know how to specify under what folder replace the files, for example, I want that it search/replaces all files under /var/www/mysite/htdocs folder.

View 1 Replies View Related

Programming :: Way To Find Core Files In System With Out Using "Find" Command

Jul 30, 2010

Is there any way to find the core files with out using the FIND command?

View 1 Replies View Related

Programming :: How To Find Files With Partial Name

Sep 1, 2010

I am fairly new to linux but I want to write a function to find any file with only a partial name. I can only use sh shell and busybox applets for this.I could do something like the sad code below...

Code:

TEST_ONE=$(find /path/to/directory -name *$1*)
TEST_TWO=$(find /path/to/directory -name $1*)
TEST_THREE=$(find /path/to/directory -name *$1)

[code]....

fi I just made that up but obviously it is pretty bad I'm sure there is a much better way to do it but I just can't think of a way. I also would like to have the file found even if capital letters are used and the file is all lower case.

View 2 Replies View Related

Programming :: Find Files With Missing Text?

Oct 19, 2010

Need to make sure a security line is added in to every webpage on a site, trying to find out how to list only the filenames of the pages that are missing the text. awk or grep? o what I want is to list all files NOT containing the word 'securemasthead'

View 2 Replies View Related

Programming :: Find Files Older Than X And Count Them?

Nov 29, 2010

I have log files that should be parsed and then deleted by a script on a regular basis. Sometimes things don't work for a variety of reasons and the log files sit and sit and are never dealt with. What I need is a small script that can give me the files older than X days and a count of those files.

What I have so far helps me take care of things manually but I need a little automation in my life Here is what I have: I can count all the files in the necessary directories recursively with this: ls -laR | wc -l And I can find all the files that are older than 10 days that haven't been deleted yet by doing this: find /home/mike/logs -type f -mtime +10 But how do I put both of them into a script that will just give me the end number of both?

View 5 Replies View Related

Programming :: Find A Word From Different Files In System?

Dec 22, 2010

How to find a word from different files in linux ?
Is there any command like (find . / -name *****), that can search files in the system for a particular word in Linux?

View 5 Replies View Related

Programming :: Bash Find Files On Time Help?

Mar 11, 2011

I am trying to find a nightly backup if it was successfully copied over, rename it and curl, but it's always passing the check even if the file is older than specified. From the command line it does as it should. Example is here;

Code:
find /backup -type f -mmin +4440 -exec echo "found" {} ;
- nothing returned (good). Then I change the time

[code].....

View 4 Replies View Related

Programming :: Cannot Find Header Files To Use Kmalloc()

Jun 16, 2010

I want to use kmalloc() to allocate contiguous memory on ram. But I can not seem to find the required header file(s) like linux/slab.h. I suppose I do not have the required library and I certainly do not know what and where to look.

View 14 Replies View Related

Programming :: Applying A Script To All The Files Of The Find Command?

Oct 18, 2010

Code:
find "$SOURCEDIR" -type f -name "*$ITEM" -printf "%P
"

I want to apply some shell script to the files outputed by the find command.

How can i do this.?

There are multiple files directories and also multiple files.

View 14 Replies View Related

Programming :: Find The Files With Extension .h Or .c With Bash Scripts?

Feb 3, 2011

i want to find all files with .h or .c extension and print them on the screen. How can i do it with bash script programming?

View 5 Replies View Related

Programming :: Perl - Counting Files With File - Find

Dec 20, 2010

So this is my code:

Code:

Modification of code I found here. It works, but I don't really know why.

Q1: Why is each filter hit counted only when the conditional is not true?

Q2: I've tried taking the file type, (.old), and put it into a variable for better usability, but then the script fails.

View 14 Replies View Related

Programming :: Find Sys/types.h File / Library Files?

Mar 24, 2009

can anyone provide me with the path where i can find the library files. stdio.h, sys/types.h.......

View 4 Replies View Related

Programming :: Bash Script To Find Newest Files And Count Them?

Feb 25, 2010

I'm working on a bash script that will go through a directory, find the sub-directories that have been created since the last time the script ran, count the results, and output that integer (will most likely be '1' or less per each instance run) to a file. Give the circumstances, my previous (and very limited) experience with bash is not sufficient for me to pull this off. since it probably has bearing, is that my mail server stores files that it flags as viruses in a folder. It creates a sub-directory for each virus that it quarantines .I want to count those subdirectories and graph them with MRTG. Hence the script. I'm going to post what I've got so far and the purpose of it, because I'm told I have a very odd and efficient way of doing scripting.

[Code]...

But then it dawned on me that it wouldn't work because I would have to not count the directories that have already been counted and count the ones that have not been counted. Given that the purpose of this is to generate a graph about every 5 minutes, using find won't work because, to my knowledge, that will only find things based on whole day values, I need it almost down to the minute.

View 1 Replies View Related

Programming : Find Out Files That Are Changed Less Than 10 Hours With Grep Command?

Mar 20, 2010

Getting the list of files in the root directory that have changed less than 10 hours earlier, using grep, but without the directories.

View 1 Replies View Related

Programming :: Find Source Code Of C Library Files In Ubuntu?

Feb 26, 2009

Where do i found source code of c library files in ubuntu.

View 2 Replies View Related

Programming :: Bash Script To Find And Remove Similar Lines From Multiple Files?

Jun 5, 2009

I want to remove duplicate or multiple similar lines from multiple files. I.e. if I have four files file1.txt file2.txt file3.txt and file4.txt and would like to find and remove similar lines from all these files keeping only one line from these similar lines. I only that uniq can be used to remove similar lines from a sorted file.

View 9 Replies View Related

Programming :: Find All The Files Not Owned By Root:root On The Commandline

Sep 9, 2010

I need a way to find all the files not owned by root:root on the commandline. How can this be done?

View 2 Replies View Related

General :: Find/grep/wc Command To Find Matching Files - Print Filename And Word Count?

Sep 11, 2009

I am trying to do a find/grep/wc command to find matching files, print the filename and then the word count of a specific pattern per file. Here is my best (non-working) attempt so far:

wc `find . ( -name "*.as" -o -name "*.mxml" ) -exec grep -H HeightResizableList {}` ;

View 10 Replies View Related

General :: Command Line - Use Find To Find Text Files?

Jul 15, 2011

Is there a way to specify to find that I only want text files (and not binary files)? Grep has an option to exclude binary files, so I thought find probably has a similar feature, but I've been unable to find it.

View 2 Replies View Related

General :: Find Setuid Files Using FIND Command?

Jan 25, 2009

I know how to search for normal files but can you let me know " How to search for 5 setuid files on the system. Also explain, for each file, why setuid mechanism is necessary for the command to function properly"

View 1 Replies View Related

Software :: Zip - Excluding Whole Directory Path ?

Sep 12, 2010

I'm trying to compress with zip for linux utility a file

Is need to be done (example):

But I would like that in the zip file there is only one file: source.file instead the whole directory path /usr, /src,... and the file.

I can't move up to the directory /usr/src/ to execute the command.

I must do this from / directory.

If this possible? I Windows systems even if I do the zip C:directory1directory2source.zip C:directory1directory2source.file, it does what I need: a Zip in directory2 with just the file source.file.

I've been looking up the man page for zip, but did not find anything useful, tried, -j, -D with no success.

View 1 Replies View Related

OpenSUSE Network :: Nfs And /etc/exports - Excluding Certain Subdirectories

Jun 30, 2011

I have a nfs share on my 11.4 workstation at /abcd. I'd like to export everything under /abcd except for one directory /abcd/dontexport

I searched online for such an option but only came across noaccess option which doesn't seem to work.

exportfs says it is an unrecognized option if I run "exportfs -ra"

This is how my /etc/exports looks like:

Code:
/abcd*(rw,wdelay,root_squash,no_subtree_check,anonuid=12345,anongid=6789)

View 2 Replies View Related

Ubuntu :: Cat/grep, Excluding Phrase From Result?

Feb 2, 2010

I would like to take a file looking like...

uid=user1,ou=People,dc=company,dc=com
uid=user2,ou=People,dc=company,dc=com
uid=user3,ou=People,dc=company,dc=com

[Code]...

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved