'获取收银机目录下的文件
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
Public Shared Function GetDirFile()Function GetDirFile(ByVal dir As String) As String
Dim MyPath As String = ""
Dim MyName As String = ""
Dim FileName As String = ""
Try
MyPath = Path.Combine(DL_PACK_PATH, dir)
MyName = Microsoft.VisualBasic.Dir(Path.Combine(MyPath, "*.*"), Microsoft.VisualBasic.FileAttribute.Normal)
Do While MyName <> ""
If (GetAttr(Path.Combine(MyPath, MyName)) And FileAttribute.Normal) = FileAttribute.Normal Then
FileName = FileName & MyName & ", "
End If
MyName = Microsoft.VisualBasic.Dir()
Loop
Catch ex As Exception
WriteLog("GetDirFile 获取收银机目录下的文件出错:" & ex.Message)
End Try
Return FileName.Trim().TrimEnd(",")
End Function
![](/Images/OutliningIndicators/None.gif)
'删除收银机目录下的所有文件
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
Public Shared Function DeleteDirFile()Function DeleteDirFile(ByVal dir As String) As Boolean
Dim MyPath As String = ""
Dim MyName As String = ""
Dim FileName As String = ""
Try
MyPath = Path.Combine(DL_PACK_PATH, dir)
MyName = Microsoft.VisualBasic.Dir(Path.Combine(MyPath, "*.*"), Microsoft.VisualBasic.FileAttribute.Normal)
Do While MyName <> ""
If (GetAttr(Path.Combine(MyPath, MyName)) And FileAttribute.Normal) = FileAttribute.Normal Then
My.Computer.FileSystem.DeleteFile(Path.Combine(MyPath, MyName))
End If
MyName = Microsoft.VisualBasic.Dir()
Loop
Return True
Catch ex As Exception
WriteLog("DeleteDirFile 删除收银机目录下的文件出错:" & ex.Message)
Return False
End Try
![](/Images/OutliningIndicators/InBlock.gif)
End Function
posted @
2007-09-26 22:17
yongwnet
阅读(
351)
评论()
编辑
收藏
举报