Programming :: Find Syntax Exclude Certain Extensions And Filter By Age
May 26, 2010
I'm trying to find all the files in a specified directory that do NOT end in .archived or .error and are older than 30 mins. Currently I have: Code: find /opt/edi/incoming -type f ! ( -name "*.archived" -name "*.error" ) -cmin 30 But I keep returning files that end in those extensions and I'm not sure if I'm using -cmin correcty? If there is a better way to do this (perl, etc) I'm open to options, this is for a nagios check.
View 2 Replies
ADVERTISEMENT
Apr 29, 2010
Looking for some help to fix 2 problems I have in my script. (I�m using bash on cygwin)I have the following source file ($7 does not have data):
Code:
HEADER_1,HEADER_2,HEADER_3,HEADER_4,HEADER_5,HEADER_6,HEADER_7
pattern2,pattern7/Sub data1/Sub data2,pattern8,pattern9,pattern2,pattern2,
pattern3,pattern6/Sub data1/Sub data2,pattern7,pattern3,pattern5,pattern1,
[code]....
In line 5 of the script, that is " {$2 !~ /pattern4|pattern5|pattern6/ }" oriented to delete lines containing pattern4, pattern5 and pattern6 from column 2 it seems not to be working. If I see the output, the line highlighted in red, is present and should not appear, because this line does not contain nor HEADER nor pattern1 nor pattern2.
View 7 Replies
View Related
Jul 19, 2010
I'm trying to backup a whole startup disk to another with GRSYNC but I don't need some files or directories. For example, I don't want to backup my 'swapfile1' (I do not have a dedicated swap partition) or the 'media' directory' in order to no enter a looping sync.I've searched the web for the correct syntax of the --exclude command but none have worked if applied in the advanced option "before" rsync starts. These a sample of NOT workin syntaxes:
exclude /media or -- exclude 'media' or -- exclude "media"
same for swapfile1:
exclude swapfile1 or -- exclude 'swapfile1' or -- exclude "swapfile1"
View 7 Replies
View Related
Jan 20, 2010
I want to search files excluding the NFS find / -mount -name 'filename' restricts the search only in the root disc partition,but the file can be in other partitions also.Is there any way to exclude the NFS only...
View 7 Replies
View Related
Feb 5, 2011
i have this find command to find modified files and copy them.Code:find $SRC_DIR -type f -ctime -1|xargs -i cp --parents {} $BACKUP_DIR/$DAY/and it works good but it want to exclude files that exist in some folders like $SRC_DIR/cash and $SRC_DIR/woks/tmp
View 3 Replies
View Related
Dec 7, 2010
I'm trying to find all java files in bash that contains the method "assign()".I would like to retrieve the same list except without the Test* files. How can I do that?
View 3 Replies
View Related
May 20, 2010
I found a script on webmaster world that mostly does what I need it to, but have been making modifications to tailor it to my specific needs.I know that //..*/ tells awk to ignore hidden directories, how do I define more directories to ignore? (i.e. temp, var, etc)? I've tried playing with prune before the awk command with limited success...I know that there are many ways to do the same thing and keep running into brick walls.
View 11 Replies
View Related
Jun 28, 2010
I have the following command which finds all files that have changed in the last day and lists them. How can I exclude hidden files like .bash_history?
View 3 Replies
View Related
Mar 2, 2011
I am doing a migration and where i face problem with few file formats . I have the list of acceptable file formats , now i need to find the rest of the file formats other than the acceptable file formats. is there any tool available for this ? or can some give me the VBA macro .. My VBA macro works to find the file extension in a particular folder but the problem is its ending when the count increases to 65000 (excel limit). How do i use If condition here to avoid the acceptable format and give me unique file formats .
[Code]....
View 1 Replies
View Related
Aug 28, 2010
Just bought a netbook, ASUS Eee PC 1001PX, and got rid of the crappy XP pre-installed. first i put netbook remix on it, and tried many downloads and ndiswrapper to fix the wireless problem. then i went ahead and put another form of ubuntu on it thinking it might have the right drivers need to use the built-in wireless card, nothing. i dl all updates and bug fixes. i went to atheros to download the only driver they have for linux in the AR8132 class but still not helping. although i am not sure if i even installed. once dl it only extracted itself. i couldnt figure out how to run. if someone has this type of netbook it would be awesome. everything works on it except wireless and headphone jack. i know its just cosmetics but it would be nice if all hardware worked.
View 1 Replies
View Related
Dec 28, 2010
I have a directory of a load of files without extensions. I know what the filetype should be, so is there any way of batch renaming the files to append a given extension onto it. i.e. text would be renamed as text.txt?
View 3 Replies
View Related
Jul 11, 2011
I have a deep folder structure on my RHEL 5.x file system which is supposed to have only word(*.doc, *.docx) or pdf(*.pdf) files. But I want to check if there are files with any other extensions which exist. Is that possible?
View 2 Replies
View Related
Jun 16, 2010
how to delete string inside the file addresses.txt. The string I want to delete on addresses.txt was on removed.txt. I have a file addresses.txt and it includes the ff format:
test@foo.com
true@fee.com
fee@tik.com
ew@kit.com
test@foo.com
[Code].....
View 5 Replies
View Related
May 30, 2010
I have the following command that I run on cygwin:
find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | xargs du --max-depth=0 > foldersizesreport.csv
I intended to do the following with this command: for each folder under /d/tmp/ that was modified in last 150 days, check its total size including files within it and report it to file foldersizesreport.csv however that is now not good enough for me, as it turns out inside each
/d/tmp/subfolder1/somefile.properties
/d/tmp/subfolder2/somefile.properties
/d/tmp/subfolder3/somefile.properties
/d/tmp/subfolder4/somefile.properties
so as you see inside each subfolderX there is a file named somefile.properties inside it there is a property SOMEPROPKEY=3808612800100 (among other properties) this is the time in millisecond, i need to change the command so that instead of -mtime -150 it will include in the whole calculation only subfolderX that has a file inside them somefile.properties where the SOMEPROPKEY=3808612800100 is the time in millisecond in future, if the value SOMEPROPKEY=23948948 is in past then dont at all include the folderin the foldersizesreport.csv because its not relevant to me.so the result report should be looking like:
/d/tmp/,subfolder1,<itssizein KB>
/d/tmp/,subfolder2,<itssizein KB>
and if subfolder3 had a SOMEPROPKEY=34243234 (time in ms in past) then it would not be in that csv file.so basically I'm looking for:
find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | <only subfolders that have in them property in file SOMEPROPKEY=28374874827 - time in ms in future and not in past | xargs du --max-depth=0 > foldersizesreport.csv
View 1 Replies
View Related
Mar 10, 2010
I have a project directory that contains source code and subdirectories of source code. I want to use the Unix program find to search recursively for the names of files of certain extensions. The versions of find on Linux and Mac OS X behave differently.
# Works in Linux
find . -type f -regex ".*.(py|html)$"
# Neither of these works in Mac OS X
find . -type f -regex ".*.(py|html)$"
find . -type f -regex ".*.(py|html)$"
How do I write this command so that it will run on Mac OS X (and hopefully on Linux too)?
View 2 Replies
View Related
Jan 3, 2009
I have a large number of files, all of them named /*/*.xyz I need to match them to potential files name /*/*.abc I have tried find -name *xyz |awk '// {print '$NF'}' | awk '{print $NF }' but the result has the full path I just need the filename without the extention, and without the full path.
View 5 Replies
View Related
Aug 2, 2010
I'm having trouble figuring out how to list the contents of a directory and exclude any subdirectories.
View 5 Replies
View Related
Feb 12, 2010
exec, a option of find command, takes a odd format as followsfind ... -exec command {} ;Is there any explaination about why it takes this kind of format, orsome obscure implication?
View 3 Replies
View Related
Jun 9, 2010
how would the syntax of reverse find be..i want to type a name and then find it and delete it from a file i have?
View 2 Replies
View Related
Feb 3, 2010
i have created on folder in my server to upload some regular states. I want that user can modify or upload already stored files. but, should not upload any unwanted files orfolders.for that i want to use "rm" command as auto scheduler (putting this in cron tab.so that all files will be removed except some required files / folders for which this upload facility is activated. users are using secure-shell for uploading data.
View 1 Replies
View Related
Dec 3, 2010
i have a sample that looks like this:
Code:
[schneidz@hyper temp]$ wget -q --output-document=- http://world.needforspeed.com/SpeedAPI/ws/game/nfs-w/leaderboards/events
[code]....
View 2 Replies
View Related
Mar 8, 2010
How can I filter ASCII quotes( ' ) and double quotes ( " ) so that I can replace them with the UTF-8 equivalent?If I copy text from a Word Document(ASCII), and upload it to a web page with PHP. The Database(UTF-8) will replace these racters with incorrect character(s).I need some function that will replace these characters but I don't know how to differentiate the ASCII quotes and the UTF-8 Quotes without (somehow) converting the string to hex, then preg_replace'ing the hex code for the symbol.
View 8 Replies
View Related
Aug 30, 2010
i have file server 1 (filesvr01acess.log) and disc server 1 (discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.81)
Similiarly i have file server 2 (filesvr01acess.log) and disc server 2(discsvr01acess.log) in unix box(say ip adress of the box 10.39.66.82). Now my requirement is write sheel script for ..
1. I need only last 24 hour data out of the file server 1 and file server 2 and then finaly put this data in one new file
2. Similiarly same need for discserver 1 and discserver 2.
FYI, each .log files mentioned above is nicely order as date and time as it is created. I can view through cat or search by using grep comand in unix I am wondering if we can achieve through grep command in unix
View 1 Replies
View Related
Jan 27, 2010
I'm a n00b to both numpy and python. I was wondering what the most intelligent way to write the trapezoid rule function was:
Code:
>>> import numpy as np
>>> a=np.array([1,2,3,4,5])
>>> def mytrapz(vec):
total=0
for i in xrange(0,len(vec)-1):
total+=(vec[i]+vec[i+1])/2.0
return total
>>> mytrapz(a)12.0 This is exactly what I would do in C and I'm sure the for loop is not the fastest way (as is the case for my interpreted langs). Yes, I know there is already numpy.mytrapz... I'm interested in the most efficient way to loop over arrays in such a way that each iteration accesses more than one cell.
View 1 Replies
View Related
Oct 21, 2010
I am trying to write a bash script that will extract a .cbr (.rar) file, traverse the extracted files in alphabetical order and rename them 001.JPG, 002.JPG, 003.JPG, etc.So far I only have this much to extract it:
Code:
#!/bin/bash
#
[code]....
View 8 Replies
View Related
Apr 15, 2010
I've got two files. They both contain package names. Is there any way I can go through the package list on one file, and search to see if each package exists in the other file? What I'd want to do, is if the package name is found in the the main file, then go to the next line. If its not found then print that package name to another file.
I know you can use diff, but it doesn't seem to be that straight forward. As I understand it diff searches line by line, so if line one doesn't match line one in another file, then it prints it out. That's not exactly what I want.
I just really need an easy way to filter out the additional packages that exist on a new server. If I have a list of packages that aren't on the original server, then i can just delete them.
Not sure if I've made any sense but there must be a quicker way to do what i need to. It would take me ages to scan manually through the package names in each list, and highlight the ones i dont need.
View 2 Replies
View Related
Feb 10, 2010
I'm building my first BASH programs and I have a hard time. I can't do a search in a folder and filter only script files without extension, the problem is to differentiate the script files from the others. I tried with ls I tried with find and i don't find a way to make it work.
View 8 Replies
View Related
Sep 28, 2010
Code:
// create a filechooser;
JFileChooser chooser = new JFileChooser(cwd);
FileNameExtensionFilter filter = new FileNameExtensionFilter(
"sdf files (*.sdf)", "sdf");
[code]....
This will give 3 filefilters ('all files', 'sdf files' and 'xml files') for a fileopen dialog. Exactly as I want (in alphanumerical order), but XML is the default extension and I like SDF to be the default extension. Research has not revealed solutions; the setFileFilter method sets the primary filter. If I swap the sequence in the code, SDF becomes the default (as I want) but the sequence is wrong (All, XML, SDF).
View 3 Replies
View Related
Feb 21, 2010
I am getting this error "Unknown filter "police", hence option "rate" is unparsable. This is in Linux Kernel 2.6 which is compiled with the "policing" option enabled in Qos (Kernel config). The error seems to be coming from the file tc.c in iproute2/
static int parse_nofopt(struct filter_util *qu, char *fhandle, int argc, char **argv, struct nlmsghdr *n) {
__u32 handle;
if (argc) {
fprintf(stderr, "Unknown filter "%s", hence option "%s" is unparsable
", qu->id, *argv);
return -1;
} if (fhandle) {
struct tcmsg *t = NLMSG_DATA(n);
if (get_u32(&handle, fhandle, 16)) {
fprintf(stderr, "Unparsable filter ID "%s"
", fhandle);
return -1; }
t->tcm_handle = handle; }
return 0; }
This is called from get_filter_kind() which is called from tc_filter_modify(), called from do_filter(), from do_cmd() from main()...all in tc.c. Is this a known "bug" in iproute2+2.6 as the 2.4 Kernel works with the same settings?
View 14 Replies
View Related
Mar 14, 2010
Code:
x = self.spinbox37.value() * 40
y = self.spinbox38.value() * 40
[code]...
View 1 Replies
View Related