Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7861019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:31:46+00:00 2026-06-02T22:31:46+00:00

I need to create a cron job that will tar all images created within

  • 0

I need to create a cron job that will tar all images created within the last X days.
I use cron jobs on my websites by setting them up in CPanel, but I’m not an experienced script writer when it comes to unix stuff. Any help will be appreciated.

This is my cron job:

0 4 * * 1 tar pzvcf /home/xxxxxx/public_html/backups/images_backup.tar /home/xxxxxx/public_html/images/products
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:31:55+00:00Added an answer on June 2, 2026 at 10:31 pm

    Use find to locate all the images and feed them to tar.

    Something like this should give you file created in the last 2 days (the -2 means < 2*24 hrs)

    find <path> -ctime -2 -print
    

    Something like this probably does the whole job:

    find <path> -ctime -<within_days> -print | tar cf <output.tar> -T -
    
    You need to specify:
      <path>        (where to search for images)
      <output.tar>  (output file name)
      <within_days> (add files < this many days old)
    

    tar cf <file> creates a tarball, tar af <file> appends to an existing tarball

    The -T - tells tar to read the list of commands from stdin.

    The find command echos the list of matching files to stdout.

    The | joins the stdout of the find to the stdin of the tar: so tar should add all the file found by the find.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create cron job that runs a script every 5 seconds. Seeing
Im trying to create a cron job involving aggregating emails sent within a period.
I need to create a persistent Java based application that will run at set
I am in need to create a cron triggers expression which should fire on
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
Need to create a custom DNS name server using C which will check against
If I need to create recurring tasks in delayed jobs, what is a clean
I have created a system that will be calculating data every month based on
We have a cron job that runs once a day and sends daily emails
In my Zend framework Project I want to create a Cron Job . I.e.,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.