Jump to content

dirremove wildcards and network share Help


Recommended Posts

It looks like you can not use wild cards with dirremove and you can not access admin shares with dos del or rd. Anyone know how we can delete wildcarded prodiles off a network share?

DirRemove("\\csctc1\C$\Documents and Settings\" & "$profile & ".*",1)

we want to remove profiles like

profile.1

profile.1.2

so on and so on

and keep

profile_second

but the real issue is using wildcards over a net admin share. any ideas?

Link to comment
Share on other sites

It looks like you can not use wild cards with dirremove and you can not access admin shares with dos del or rd. Anyone know how we can delete wildcarded prodiles off a network share?

DirRemove("\\csctc1\C$\Documents and Settings\" & "$profile & ".*",1)

we want to remove profiles like

profile.1

profile.1.2

so on and so on

and keep

profile_second

but the real issue is using wildcards over a net admin share. any ideas?

maybe something like this? (untested)

$search = FileFindFirstFile("\\csctc1\C$\Documents and Settings\*.*")
While 1
    if @error Then ExitLoop
$file = FileFindNextFile($search)
$ats = FileGetAttrib($file)
if StringInStr($ats,"D") And StringInStr($file,".") Then
    DirRemove($file,1)
EndIf
WEnd
Link to comment
Share on other sites

this does not seem to work or do anything. Not really concerned about the atrib of the folder any ideas

the attrib check is to make sure that the file being examined is a directory. the loop checks each file in the specified folder to make sure that if the file being examined is a directory, and has a decimal in the name, the directory should be removed. If nothing is happening when you run it, you may want to have the result of the DirRemove() assigned to to a variable...

$blah = DirRemove($file,1)
msgbox(0,"result",$blah)

then you can tell if the directory was not removed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...