Basic File Class
pretty basic file class.... you can get the filename, path, drive, and extension of a file (string)... and plus you can copy files, delete files, create blanks for files (useful for prop files), and wipe files... havent tested the wipe but from what i see it should work... please vote and PLEASE COMMENT!
AI
AI Samenvatting: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Broncode
Function GetFilename(path As String) GetFilename = Mid(path, InStrRev(path, "/") + 1) End Function Function GetFilepath(path As String) GetFilepath = Mid(path, 1, InStrRev(path, "/")) End Function Function GetFileExt(path As String) GetFileExt = Mid(path, InStrRev(path, ".")) End Function Function GetFileDrive(path As String) GetFileDrive = Mid(path, 1, InStr(1, path, "/")) End Function Function CreateBlank(path As String) Dim Free As Integer Free = FreeFile Open path For Binary As Free Close Free End Function Function FileExist(path As String) On Error GoTo Oop Dim Free As Integer Free = FreeFile FileExist = True Open path For Input As Free Close Free Exit Function Oop: FileExist = False End Function Function CopyFile(oldpath As String, newpath As String) FileSystem.FileCopy oldpath, newpath End Function Function DeleteFile(path As String) Kill path End Function Private Function Rand(L, U) As Long Dim I As Long For I = L To U If Int(Rnd * (U - L)) = Int(Rnd * (U - L + 1)) Then Rand = I: Exit Function Next I End Function Private Function ScrambleArray(ar()) Dim I As Long For I = LBound(ar()) To UBound(ar()) ar(I) = ar(Rand(LBound(ar()), UBound(ar()))) Next I End Function Function WipeFile(path As String) Dim I As Long, B() As Byte, Free As Integer Free = FreeFile Open path For Binary As FreeFile For I = 0 To 500 Get #1, , B() ScrambleArray B() Put #1, , B() Next I Close FreeFile End Function
Originele reacties (3)
Hersteld van de Wayback Machine