Re: Help finding files with shell script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15Sep2007 20:00, Paul Ward <pnward@xxxxxxxxxxxxxx> wrote:
| Hi All,
| 
| Anyone know an easy way of finding files in a directory that have been
| created within 24 hours but are not being written to.
| 
| The only way I can think of doing this is as follows
| 
| eg (Not sure of my syntax yet as this is just theoretical)
| crond to run at 00:01
| find /myth/recordings/ -maxdepth 1 -name '*' -mtime -1|grep
| ".mpg"|grep -v ".png" > file1
| find /myth/recordings/ -maxdepth 1 -name '*' -atime -5|grep
| ".mpg"|grep -v ".png" > file2
| then somehow remove files2 from files1 list and do a for i in `cat file1`;do etc
| 
| There must be a better way of doing this?

As Robert Day says, UNIX files don't have creation times. They have a ctime
which is "last change to inode" - it updates on chmod, rename etc.

But pretending ctime is creation time, which may be close enough for
your purposes:

  find /myth/recordings/ -maxdepth 1 -name \*.mpg -ctime -1 ! -mtime -1 -print

remarks. Your '-name "*"' seems redundant.

If you do end up comparing lists (should not be necessary for your problem,
since you can do all the testing with find), "sort" and "comm"
are your friends.
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Try not to get sucked into the vortex of hell, Billy!
        - MST3K, "Megalon vs. Godzilla"

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux