VBS wildcard

Discussion in 'OT Technology' started by lightsareout, Oct 29, 2008.

  1. lightsareout

    lightsareout New Member

    Joined:
    Aug 19, 2006
    Messages:
    5,913
    Likes Received:
    0
    Location:
    Murfreesboro, TN
    i'm still working on that script, yeah i know i'm slow but i have a lot of projects going on now and this is the least important right now.

    here is the part thats giving me problems is:

    here is the path that i'm working with:
    C:\Documents and Settings\Username\Local Settings\Application Data\Mozilla\Firefox\Profiles\ProfileID.default\Cache


    and here is what i have:
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.DeleteFile("C:\Documents and Settings\Username\Application Data\Mozilla\Firefox\Profiles\*.*"),


    so when i put %username% in for the username i get an error. and how do i wildcard the path to get into the cache folder so that:
    C:\Documents and Settings\Username\Local Settings\Application Data\Mozilla\Firefox\Profiles\*\Cache


    so 2 things-
    1)how to set the user name in the path?
    2)how to wildcard a folder in the path?
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
  3. lightsareout

    lightsareout New Member

    Joined:
    Aug 19, 2006
    Messages:
    5,913
    Likes Received:
    0
    Location:
    Murfreesboro, TN
  4. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    You'll have to cycle through the directory structure - you can't use a wildcard as you've suggested.
     
  5. Doomsday

    Doomsday XXX

    Joined:
    Mar 14, 2000
    Messages:
    14,902
    Likes Received:
    0
    Location:
    Minnesota
    try this

    Set oShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    vappdata=oShell.ExpandEnvironmentStrings("%AppData%")
    objFSO.DeleteFolder(vappdata & "\Mozilla\Firefox\Profiles\*")


    if you don't want to use %AppData%

    Set oShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    vuser=oShell.ExpandEnvironmentStrings("%UserName%")
    objFSO.DeleteFolder("C:\Documents and Settings\" & vuser & "\Application Data\Mozilla\Firefox\Profiles\*")
     
  6. lightsareout

    lightsareout New Member

    Joined:
    Aug 19, 2006
    Messages:
    5,913
    Likes Received:
    0
    Location:
    Murfreesboro, TN
    i got it firgured out, i just found the sub folder name, set it to a variable and used that in the path of what i was deleting
     

Share This Page