Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Removing the oldest file in all directories


    How can I write a simple bash script that will remove the oldest file in all directories, but it should display these files including their dates and ask me if i want to delete them first, before these files get deleted.



    Thanks,

  2. #2
    Just Joined! sathiya's Avatar
    Join Date
    Feb 2008
    Location
    Bangalore, India
    Posts
    97
    steps:
    1. go over the directories one by one.
    2. in every directory, say ls -lrt, and take the last entries and remove it off ??

    Have you got it ??

    Or you want some thing else ??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •