Page 1 of 1 1
Topic Options
#152243 - 2005-11-24 10:51 PM Need to Wild Card a directory ??
Skip Offline
Fresh Scripter

Registered: 2005-07-01
Posts: 41
I have a directory structure that looks like the one below. I need to remove all the log files in the \WRC* directory, but I can't touch any *.log files in the parent DIR's. I have found the DIRPlus() UDF, and can successfully remove all *.log files. But I don't know what is in the root directory's

Sructure.
X:\Ilovetacos\stats\WRC87635887\*.log
X:\Ilikepizza\stats\WRC88754999\*.log
X:\NoVinegar4me\stats\WRC9875498\*.log
X:\makesmewannawagmytail\stats\WRC85489227\*.log

Working Code, but removes *.log from all the entire X: Drive, nut just under the \stats\WRC*\ folders
Code:
  
$files = dirplus("X:\","/s /a-d /m dir|.log")



I have tried both of these, and countless other variations without success. Can anyone help me out?
Code:

$files = Dirplus("X:\*\stats\*","/s /a-d /m dir|.log")
Code:



$files = dirplus("X:\","/s /a-d /m dir|'*\stats\*\'+'*.log'")

_________________________
-sphilip

Top
#152244 - 2005-11-24 11:47 PM Re: Need to Wild Card a directory ??
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Then delete only those files that are in a WRC subdirectory, e.g. via INSTR().
_________________________
There are two types of vessels, submarines and targets.

Top
#152245 - 2005-11-25 04:06 AM Re: Need to Wild Card a directory ??
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Code:

$files = dirplus("X:\","/s /a-d /f log")

for each $file in $files
if instr($file.path,'\wrc')
;this file is in a \wrc* subfolder.
$file.delete
endif
next



Bryce

Top
#152246 - 2005-11-25 04:55 AM Re: Need to Wild Card a directory ??
Skip Offline
Fresh Scripter

Registered: 2005-07-01
Posts: 41
Thank you both. This works like a charm. I kept going round and round with it. As always this board saved the day.

Happy Thanksgiving and or Season's Greetings!!
_________________________
-sphilip

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2870 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.055 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org