• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

rm file on a specifc date

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I want to delete the results of following command

ls -lt | grep 'Aug 31'

I have already tried following

create a file

touch -t 200909010000 Sep01

and then run

find /da/prod/daprod/batch_ftp -newer Sep01 -exec ls -la {} \;

but this command returns nothing. I thought the above command will work and I'll simply replace ls by rm. This is a n AIX box. Can someone please help?

Thanks
Imad
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aug 31 doesn't look newer than Sep 01 to me, or am I missing something?

Files older than one day might be specified by mtime:

Instead of rm you may use -delete, at least while using gnu-find, I'm guessing from my linuxbox.

 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right. I was supposed to use not newer. I created two files. One with timestamp on August 30 23:59 and other with Sep 01 12:00. Now I was trying to delete files using between these two file (newer and !newer). Problem is it was also fetching files from sub directories. I don't want to delete files from sub directories.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may use masdepth to prevent find from visting subdiers:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic