Sponsored Content
Full Discussion: Find + prune + mtime
Top Forums Shell Programming and Scripting Find + prune + mtime Post 302402257 by Nicol on Tuesday 9th of March 2010 08:58:51 AM
Old 03-09-2010
Find + prune + mtime

Hi,

i try to catch all files in a dir ,without going down in subdir , which don't have file extension and older than 10 days for example:

my dir :

Code:
drwxr-xr-x   7 notes01  notes          4096 Mar  8 14:11 .
drwxr-xr-x 116 root     system         4096 Mar  9 11:17 ..
-rw-r-----   1 notes01  notes            46 Apr  5 2006  .kshrc
-rw-r-----   1 notes01  notes            46 Apr  5 2006  .kshrc-02
-rw-------   1 notes01  notes            95 Jun 26 2007  .netrc
-rw-r-----   1 notes01  notes          1928 Feb 24 15:47 .profile
-rw-r-----   1 notes01  notes         38502 Oct 19 17:28 .rhosts
-rw-------   1 notes01  notes         15480 Mar  9 14:49 .sh_history
-rwxr-x---   1 notes01  notes          2689 Feb 26 2007  1st-distri.ksh
drwxr-x---   2 notes01  notes          8192 Mar  9 07:00 LOG
-rw-------   1 notes01  notes          1826 Feb  5 2009  alias.ksh
-rw-r-----   1 notes01  notes          8747 Feb 25 08:24 crontab-fevrier-2010
-rw-r-----   1 notes01  notes          8449 Feb 25 15:21 crontab-mars-2010
drwxr-x---   2 notes01  notes          4096 Mar  3 10:00 deleted_by
drwxr-x---   2 notes01  notes          4096 Feb 24 16:15 profile
drwxr-x---   2 notes01  notes          4096 Mar  2 17:06 save-crontab-ANC
drwxr-xr--   3 notes01  notes           256 Jan 30 2009  scripts
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test 2
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 toto

i want to have :

Code:
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 test 2
-rw-r-----   1 notes01  notes             0 Mar  9 14:53 toto


so i test to use with find command the prune and mtime flag :

Code:
find . \( -type d ! -name . -prune \) -o \( -type f -mtime +10 -print \) -exec ls -al {} \;|grep -v '\./'|grep -v '\.'

it succeed if there is no mtime but with this flag the result is bad.

Can you help me please ?

Thanks
Christain

Last edited by pludi; 03-09-2010 at 10:00 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find command with prune help

I have a directory named https-abcd Under that I have some directories, files and links. One of those directories is with name logs and the logs directory has lot of files in it. I need to tar the whole https-abcd directory excluding the logs directory only, I should get all the links, files and... (2 Replies)
Discussion started by: venu_nbk
2 Replies

2. UNIX for Dummies Questions & Answers

Using prune with find command

Hi, I am using a find command like below in my script: find /outfiles -type f -name cat -o -name vi -o -name grep 2>/dev/null Which will search for files like "cat" , "vi" or "grep" in the "/outfiles" and subdirectories. I want to ignore a particular subdirectory from the search. I... (4 Replies)
Discussion started by: deepakgang
4 Replies

3. Shell Programming and Scripting

find with prune option

Hi, I want to list files only from the current dir and its child dir (not from child's child dir). i have the following files, ./ABC/1.log ./ABC/2.log ./ABC/ABC1/A.log ./ABC/ABC1/B.log ./ABC/ABC1/XYZ/A1.log ./ABC/ABC1/XYZ/A2.log Here i want to list only the log file from current... (1 Reply)
Discussion started by: apsprabhu
1 Replies

4. Shell Programming and Scripting

How to use -path and -prune with find

OK, I'm trying search and destroy tabs again. This time I'm having trouble excluding certain directories from my search. Here is what I have tried and it is not ignoring the top level build directory: find . -path ./build -prune -name \*.java -o -print | xargs grep -i ' ' I don't... (6 Replies)
Discussion started by: siegfried
6 Replies

5. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

6. UNIX for Dummies Questions & Answers

Find prune Trash

How do I run a find without is looking in ./Trash gregg@gregg-desktop:/media/Audio$ find . -type f ! -name '*.jpg' -size 1M -print |head find: `./.Trash-1000/expunged/2781324553/mp3-to-m4b-batch': Input/output error find:... (0 Replies)
Discussion started by: glev2005
0 Replies

7. UNIX for Dummies Questions & Answers

Find with Prune not working

Hi I am trying to list all files in every subdirectory from a given location. However, I realise that 1 folder will have files that I am not interested in. This is using a .csh file to execute I have tried different scripts but to no avail. My current incarnation is below. Would someone be... (4 Replies)
Discussion started by: wonderbison
4 Replies

8. Shell Programming and Scripting

find: -prune and -name options

I am trying to find all .rhosts files on some unix systems. I tried just -name ".rhosts" but we have a lot of really large NFS and MVFS systems that I do not want to crawl and I am having a hard time excluding them. I also need to scan more than just /root /home and /users, so I really need to scan... (1 Reply)
Discussion started by: nitrobass24
1 Replies

9. Solaris

Usage of -prune and -name in find

I am into cd /home/work/amey/history-*/ Under amey I have directories history, history-1, history-2 and under history-2 I have got 2 files 3 and 2. When I run the find command I get the below o/p. find /home/work/amey/history-*/. -name . -o -prune -type f /home/work/amey/history-1/.... (1 Reply)
Discussion started by: ameyrk
1 Replies

10. Shell Programming and Scripting

Using prune with find

Hi, I have two files under two separate directories as in: find . -name test.sh ./test.sh ./abc/test.sh I want my find to only look for the file test.sh that is under the current directory and not one under /abc How do I use prune to achieve this? I am on AIX (3 Replies)
Discussion started by: swasid
3 Replies
NFDUMP(8)						      System Manager's Manual							 NFDUMP(8)

NAME
nfdump, nfload - notesfile dump/load programs SYNOPSIS
nfdump notesfile nfload [ -Ddirectory ] notesfile DESCRIPTION
Nfdump and nfload are used to convert notesfile data base formats. Nfdump converts the specified notesfile to a portable ASCII format and writes it to standard output. Some diagnostics are produced on stderr. Nfdump can be run by any user; access to a particular notesfile is governed by that notesfile's access list. Nfload is used on the output from nfdump to create a new notesfile. The -D option specifies an alternate base directory for the notesfile. If unspecified, this defaults to ``/usr/spool/notes''. Nfload reads standard input for the ASCII representation of the notesfile. Typical use of these two programs occurs when converting an existing notesfile data base to a new format. The nfdump program should be compiled with the older structure definitions while nfload is compiled with the newer structures. The data base can then be converted with a shell script of the following nature: mkdir .OLD mv * .OLD for i in `ls .OLD` do echo $i start nfdump $i | nfload -D/usr/spool/newnotes $i done echo $i done echo ALL DONE rm -rf .OLD This assumes that the old data base is in ``/usr/spool/notes'' and the new data base is to be placed in ``/usr/spool/newnotes''. After the conversion is complete, one can move the old data base from ``/usr/spool/notes'' to ``/usr/spool/oldformat'' and the new data base from ``/usr/spool/newnotes'' to ``/usr/spool/notes''. FILES
SEE ALSO
notes(1), The Notesfile Reference Manual AUTHORS
Ray Essick (uiucdcs!essick, essick%uiuc@csnet-relay.arpa) Department of Computer Science University of Illinois at Urbana-Champaign Urbana, IL Rob Kolstad (kolstad@convex.UUCP) CONVEX Computer Corporation Richardson, TX University of Illinois NFDUMP(8)
All times are GMT -4. The time now is 09:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy