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 Mark Forums Read
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 09-03-2009, 07:48 AM   #1
Pics Traffic
Confirmed User
 
Pics Traffic's Avatar
 
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
PHP help needed.

I need to delete a bunch of files from subdirectories that have "pix" string in its name.

Is there way to do it with php script that I can run thru browser?
sort of like doing comand but with a siple script.

del /S *pix*
Pics Traffic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 07:56 AM   #2
UniqueD
Confirmed User
 
UniqueD's Avatar
 
Industry Role:
Join Date: Aug 2004
Location: Barcelona
Posts: 1,022
youre going to have to write a script that looks through the directories recursively and checks the file names for the string. Its def doable.
UniqueD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:03 AM   #3
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
This will do the trick.

PHP Code:
<?
foreach(globr('/path/to/dirname/','*pix*') as $v) unlink($v);
function globr($sDir, $sPattern, $nFlags = NULL) { 
  $sDir = escapeshellcmd($sDir); 
  $aFiles = glob("$sDir/$sPattern", $nFlags); 
  foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) 
  { 
    $aSubFiles = globr($sSubDir, $sPattern, $nFlags); 
   $aFiles = array_merge($aFiles, $aSubFiles); 
  } 
  return $aFiles;  } 
?>
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:03 AM   #4
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
Quote:
Originally Posted by UniqueD View Post
youre going to have to write a script that looks through the directories recursively and checks the file names for the string. Its def doable.
No shit sherlock :P
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:25 AM   #5
Pics Traffic
Confirmed User
 
Pics Traffic's Avatar
 
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
Quote:
Originally Posted by UniqueD View Post
youre going to have to write a script that looks through the directories recursively and checks the file names for the string. Its def doable.

I wish I would have thought of that.
Pics Traffic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:26 AM   #6
Pics Traffic
Confirmed User
 
Pics Traffic's Avatar
 
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
Quote:
Originally Posted by quantum-x View Post
This will do the trick.

PHP Code:
<?
foreach(globr('/path/to/dirname/','*pix*') as $v) unlink($v);
function globr($sDir, $sPattern, $nFlags = NULL) { 
  $sDir = escapeshellcmd($sDir); 
  $aFiles = glob("$sDir/$sPattern", $nFlags); 
  foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) 
  { 
    $aSubFiles = globr($sSubDir, $sPattern, $nFlags); 
   $aFiles = array_merge($aFiles, $aSubFiles); 
  } 
  return $aFiles;  } 
?>

thanks man.
Pics Traffic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:28 AM   #7
UniqueD
Confirmed User
 
UniqueD's Avatar
 
Industry Role:
Join Date: Aug 2004
Location: Barcelona
Posts: 1,022
why the fuck did you ask if there was a way to do it if you already knew there was then?
UniqueD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:30 AM   #8
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
Quote:
Originally Posted by UniqueD View Post
why the fuck did you ask if there was a way to do it if you already knew there was then?
Keep digging!
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:33 AM   #9
camperjohn64
Confirmed User
 
Industry Role:
Join Date: Feb 2005
Location: Los Angeles
Posts: 1,531
Quote:
Originally Posted by UniqueD View Post
why the fuck did you ask if there was a way to do it if you already knew there was then?
I am speachless...
__________________
www.gimmiegirlproductions.com
camperjohn64 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 08:39 AM   #10
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
Quote:
Originally Posted by MOCKBA View Post
I wish I would have thought of that.
__________________
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 09-03-2009, 09:45 AM   #11
Pics Traffic
Confirmed User
 
Pics Traffic's Avatar
 
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
Quote:
Originally Posted by UniqueD View Post
why the fuck did you ask if there was a way to do it if you already knew there was then?
Please turn off your internet connection.
Pics Traffic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 09:47 AM   #12
gornyhuy
Chafed.
 
gornyhuy's Avatar
 
Join Date: May 2002
Location: Face Down in Pussy
Posts: 18,041
Quote:
Originally Posted by MOCKBA View Post
Please turn off your internet connection.
Is there a way to turn off your internet connection?
__________________

icq:159548293
gornyhuy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-03-2009, 02:24 PM   #13
Pics Traffic
Confirmed User
 
Pics Traffic's Avatar
 
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
Quote:
Originally Posted by quantum-x View Post
This will do the trick.

PHP Code:
<?
foreach(globr('/path/to/dirname/','*pix*') as $v) unlink($v);
function globr($sDir, $sPattern, $nFlags = NULL) { 
  $sDir = escapeshellcmd($sDir); 
  $aFiles = glob("$sDir/$sPattern", $nFlags); 
  foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) 
  { 
    $aSubFiles = globr($sSubDir, $sPattern, $nFlags); 
   $aFiles = array_merge($aFiles, $aSubFiles); 
  } 
  return $aFiles;  } 
?>

worked well. thanks again
Pics Traffic 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
Thread Tools



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.