SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Feb 2000
    Location
    Campbell, CA
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Anyway to use wildcards with SYS_REMOVEFILE??

    I'm writing to files on another system which have either a .ERR or .OK extension. What I want to do is be able to remove these files but I can only do it by way of using the exact file name; I'd like to be able to use a wildcard (*.ERR or *.OK) to remove all of the files with those extensions.
    Apparently SYS_REMOVEFILE will not accept anything but the full file name.
    Anyone have any ideas on how to accomplish removing files via the 'wildcard + extension' method??
    Thanks!!!

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    MA
    Posts
    129
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Anyway to use wildcards with SYS_REMOVEFILE??

    Not directly.

    I know in the downloads sections, there are libraries of code that may have this.

    I have an implementation in my library, but I'm away from work and don't have all my dependencies with me.

    What you basically want to do is the following pseudocode:
    1) Get directory contents of the dir you are interested in (returned as a LIST OF FILEINFO, but all you care about is the .sName field of the FILEINFO record)
    2) Use MatchStr and walk the list of FILEINFO, .sName field. looking for names that match your criteria, MatchStr takes wild cards
    3) For each match, call down to SYS_RemoveFile. I suggest using do <--> except blocks with any FILEIO SilkTest code, just to be more bulletproof.

    If you are still stuck I'll see if I have time in my busy work schedule to scrape together my implementation. May be a pain if you are not used to using SilkTest records. I use records as it makes it easy for me to add new functionality that I did not think of when I code something, as compared to a long list of single arguments...

    Good luck!

    EDIT: You could also use a wrapper to the command.com (or cmd.exe on NT) del command, with the appropriate syntax. If you use SYS_Execute, you may get more than you bargained for with some strange hangs etc... I prefer my method above with the walking lists of FILEINFO.

    [This message has been edited by styler (edited 01-21-2001).]
    Steven Tyler
    Manager - Performance Engineering

    Kronos Incorporated
    tel: +1 978 947 4219

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Location
    Sunnyvale,CA, USA
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Anyway to use wildcards with SYS_REMOVEFILE??


    I use SYS_Execute command and I pretty sure it takes wildcards.

    Try SYS_Execute("del ""{sFileName}"" /Q")

    where sFileName could be "*.OK"

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Anyway to use wildcards with SYS_REMOVEFILE??

    Try this function:[-] DeleteSelectedFiles(STRING sDir)
    [ ] LIST OF FILEINFO lfInputFiles
    [ ] INTEGER iFCount
    [ ] STRING sFileName
    [ ] BOOLEAN bFnd
    [ ]
    [ ] lfInputFiles = SYS_GETDIRCONTENTS(sDir) //Sets up a list of the files within the specified directory
    [-] for iFCount = 1 to ListCount(lfInputFiles) //For each file in the list of files
    [ ] sFileName = lfInputFiles[iFCount].sName //Get the name of the current file
    [ ] bFnd = MatchStr("*.to", sFileName) //Match to see if the file contains the .to file extension
    [-] if bFnd == TRUE
    [ ] SYS_RemoveFile (sDir + sFileName)

    The input to this function is the path of the files you want to check.

    Hope this helps,
    MikeF



    [This message has been edited by MikeF (edited 02-05-2001).]

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:36 AM.

Copyright BetaSoft Inc.