Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Find Command not working

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Windows - UNIX Interop] >> System & Network Admin Forum >> Find Command not working Page: [1]
Login
Message << Older Topic   Newer Topic >>
Find Command not working - Oct. 4, '04, 7:32:46 PM   
troyhi

 

Posts: 2
Joined: Oct. 4, '04,
Status: offline
Hi when trying to find files by date, this command usto work and it has just suddenly stopped. Am I typing it correctly ? any help ? The command is

find /dev/fs/E/XXXX/XXX/product -type d -ctime +14 -print

There are files and directories below product but the command can not seem to see them. What am I missing. Thanks

Troy
Post #: 1
RE: Find Command not working - Oct. 4, '04, 8:42:03 PM   
Rodney

 

Posts: 3696
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
> Hi when trying to find files by date

The command you give isn't going to find _files_ by date. It's going to find directories.
For finding files you want to pass "f" as the operand to the '-type' option.

(in reply to troyhi)
Post #: 2
RE: Find Command not working - Oct. 4, '04, 9:02:46 PM   
troyhi

 

Posts: 2
Joined: Oct. 4, '04,
Status: offline
Rodney thanks for the answer, I actually wrote files but I did mean files or directories, so if the operand if f it looks for files and if it were d it should find directories? it works with f but not with d any thoughts why ? Thanks

(in reply to Rodney)
Post #: 3
RE: Find Command not working - Oct. 4, '04, 11:24:40 PM   
Rodney

 

Posts: 3696
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Sure, you asked for 'ctime'. That'll look at the stat field that's returned with
stat(2). Refer to that man page: ctime is "time of last file status change".
This field doesn't change often. Usually 'mtime' and 'atime' change more often with
files.

If you want to check for both files and directories at the same time with
the '-or' expression/option with find. So:
 find /dev/fs/E/XXXX/XXX/product -type d -or -type f -mtime 14 -print


Important quote from stat(2) man page:
    st_atime
        Time when file data last accessed. Changed by the utime(2) and read(2
        calls.

    st_mtime
        Time when file data last modified. Changed by the utime(2) and
        write(2) calls.

    st_ctime
        Time when file status was last changed (file serial data
        modification). Changed by the chmod(2), chown(2), link(2), rename(2),
        unlink(2), utime(2) and write(2) calls.


The other key aspect here is the type of underlying filesystem. If you are
making reference (/dev/fs/E/...) to an local NTFS disk or an NFS disk that
references NTFS, FFS or UFS then these stat fields are going to be good.
But(!) if it's an SMB (aka Samba) or FAT forget it. Some of these field
values are getting faked because the protocol doesn't support this info.

(in reply to troyhi)
Post #: 4
Page:   [1]
All Forums >> [Windows - UNIX Interop] >> System & Network Admin Forum >> Find Command not working Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.094