Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-21-2006, 04:12 PM   #1
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
A Quick PHP Question

Rather than wading through tutorials I thought someone here could probably give a quick answer. All I need is 4 or 5 lines of php code that checks a directory for a certain file and if present deletes it i.e.

check for file /directory/blah.exe
if blah.exe then delete blah.exe
end

It's for a very quick fix on a server with security issues until the various scripts are fully updated etc which will take 48 hours. To be honest it doesn't even need to be php as long as it can be run via cron.

Any help appreciated. Thanks in advance.
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2006, 04:18 PM   #2
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
just:
rm -f /home/bluh/filename

if file doesn't exist, nothing bad will happen
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2006, 04:19 PM   #3
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
if ( file_exists( $filename ) ) {
unlink ( $filename );
}

or you should probably use 'find', to delete all blah.exe from the current directory and below, something like
find . -name 'blah.exe' | xargs rm
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2006, 04:20 PM   #4
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
Thanks and you can tell it's been a long day. That's FAR too obvious.

Fuck it - I'm taking a break as it seems I need one.
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-21-2006, 04:33 PM   #5
Tipsy
Confirmed User
 
Join Date: Jul 2001
Location: See sig
Posts: 6,989
The simple solution managed it but thanks for the PHP. I have another use for that so it's handy to have
__________________
Ignorance is never bliss.
Tipsy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.