faqts : Computers : Programming : Languages : Tse : File

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

TSE: File: Remove: Ring: How to remove files in the ring? Searching

Nov 12th, 2006 11:53
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 12 November 2020 - 07:41 pm -------------------
TSE: File: Remove: Ring: How to remove files in the ring? Searching
---
Method: Use NextFile() to go trough each file, starting from the first,
        current file, and possibly removing the found files (e.g. by
        searching for (part of) the filename)
===
--- cut here: begin --------------------------------------------------
FORWARD PROC Main()
FORWARD PROC PROCFileRemoveFileSearchRingAllSimple( STRING s1, STRING 
s2 )
// --- MAIN --- //
PROC Main()
 PROCFileRemoveFileSearchRingAllSimple( "c:\temp\ddd.s", "i" )
END
<F12> Main()
// --- LIBRARY --- //
// library: file: remove: file: search: ring: all: simple 
(filenamemacro=remofias.s) [kn, ri, su, 12-11-2020 19:44:40]
PROC PROCFileRemoveFileSearchRingAllSimple( STRING searchS, STRING 
searchOptionS )
 INTEGER bufferCurrentI = GetBufferId( CurrFileName() )
 INTEGER bufferNextI = bufferCurrentI
 STRING s[255] = ""
 REPEAT
  s = CurrFileName()
  IF StrFind( searchS, s, searchOptions )
   AbandonFile( bufferCurrentI )
   // if you deleted the current file, that bufferid has gone, so you 
make it equal to the bufferid of what is then the current file now
   bufferCurrentI = GetBufferId( CurrFileName() )
  ENDIF
  NextFile()
  bufferNextI = GetBufferId( CurrFileName() )
  // thus after going through all different bufferids, until you are 
back at the original file, thus bufferid the same again
  UNTIL ( bufferCurrentI == bufferNextI )
END
--- cut here: end ----------------------------------------------------
===
Internet: see also:
---
----------------------------------------------------------------------