Find the answer to your Linux question:
Results 1 to 2 of 2
Hi All I was hoping to find out if its possible to zip file by the date and time it was created. e.g file format xxxx_xx_15278.log.2008-04-24 created on 24/04/2008 05:35:00 ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Posts
    1

    Zipping File script by Date of creation

    Hi All

    I was hoping to find out if its possible to zip file by the date and time it was created.

    e.g file format

    xxxx_xx_15278.log.2008-04-24 created on 24/04/2008 05:35:00

    what i like to do is it would check the time and date then zip the file then zip three more files above the first file.

    I do understand programming but not to advance level so any help is most welcomed.

    Thanks

  2. #2
    Just Joined!
    Join Date
    Jul 2007
    Posts
    49
    You could use something along the lines of this
    Code:
    find /location -name "*log*" -mmin +60 -exec gzip {} \;
    this would zip all the files from the file location with the word log somewhere in the name which has not been modified in the last 60 mins, there are more options you could use it would be worth taking a look at the man page for find for all the available options.

    Just be careful when using this as you could accidentally zip something you shouldn't.

Posting Permissions

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