Activity Stream
48,167 MEMBERS
6808 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1.     
    #1
    Member

    Exclamation Need php cronjob to auto dlete files after XX hours [$5]

    Hey guys, I needthis PHP cron job script which can automatically delete files within a partiuclar folder, after like 12 hours, corresponding to the 'Last Modified' Date of the file.

    Note: I'm NOT looking for cron to remove files every 12 hours..

    $5 to someone who can code it
    kohkindachi Reviewed by kohkindachi on . Need php cronjob to auto dlete files after XX hours [$5] Hey guys, I needthis PHP cron job script which can automatically delete files within a partiuclar folder, after like 12 hours, corresponding to the 'Last Modified' Date of the file. Note: I'm NOT looking for cron to remove files every 12 hours.. $5 to someone who can code it Rating: 5
    None

  2.   Sponsored Links

  3.     
    #2
    Member
    hmm... make a php file to delete files and execute that after every 12hrs through cron job ??

  4.     
    #3
    Member
    Quote Originally Posted by anantgupta View Post
    hmm... make a php file to delete files and execute that after every 12hrs through cron job ??

    LOL i posted the NOTE before you replied. But.......you gonna me kidding
    None

  5.     
    #4
    Member
    Website's:
    sborg.us
    So you basically need a php script, to put in cron jobs and the script deletes a specific file depending on the modified time?

    Or you don't wanna use cron jobs but make the script run forever to check modified time and delete the file?


  6.     
    #5
    Member
    Website's:
    LulzCovers.com LulzTroll.com
    PHP Code: 

    <?php

    $path 
    "yourfilespath";

               
    $handle=opendir($path); 
               while (
    false!==($file readdir($handle))) { 
                   if (
    $file != "." && $file != "..") {  
                       
    $Diff = (time() - filectime("$path/$file"))/60/60/24;
                       if (
    $Diff 1unlink("$path/$file");

                   } 
               }
               
    closedir($handle); 


    ?>
    this deletes the files older than 24 hours
    Contact me for Traffic, SEO, WCDDL, Wordpress, IPB related Services or queries.
    Template Designing, PSD to HTML, Wordpress


  7.     
    #6
    Member
    @V3g3t4, I want the php script to run in cron. Actually doesn't have to be PHP if u can cdoe it in sh
    None

  8.     
    #7
    Member
    Website's:
    LulzCovers.com LulzTroll.com
    save the script as del.php
    and use
    php /home/xxx/public_html/../del.php ( i.e your script path)

    and it will run in cron via cpanel
    Contact me for Traffic, SEO, WCDDL, Wordpress, IPB related Services or queries.
    Template Designing, PSD to HTML, Wordpress


  9.     
    #8
    Member
    @deAthbLisS, let me try thx

    can you tell me their time formate? So that i can change it myself. I mean how do i changed it to 12 hrs etc
    None

  10.     
    #9
    Member
    Website's:
    sborg.us
    I thought you didn't want cron jobs to be used. lol

    Well deathbliss' one will work in your case

    it's TotalTime/60(for sec)/60(for min)/24(for hrs)

    @Death, I think filemtime() is to be used.

  11.     
    #10
    Member
    Thanks. Now i would like to interprete it lol
    $Diff > 1
    what is this about?
    maybe you can show me the code to auto delete after 6 hours? so that i can see what's going on

    None

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Auto RaR Files
    By cotufa-ssdd in forum Tutorials and Guides
    Replies: 27
    Last Post: 19th Oct 2012, 07:30 AM
  2. simple cronjob involving mono and a screen
    By pisoj1 in forum Community Cooperative
    Replies: 0
    Last Post: 27th Nov 2011, 11:16 AM
  3. [Selling] Wautoposter Fully Automated Bot Script RSS FEED Auto Download Auto Upload
    By jpavsex in forum Completed Transactions
    Replies: 302
    Last Post: 10th Jul 2011, 09:30 AM
  4. [Buying] Auto Download Auto Upload Auto Post
    By arkinyildiz in forum Completed Transactions
    Replies: 20
    Last Post: 7th May 2011, 03:28 PM
  5. cronjob setup in cpanel
    By pirateaccess in forum Webmaster Discussion
    Replies: 1
    Last Post: 15th Jun 2009, 06:54 PM

Tags for this Thread

BE SOCIAL