[Gambas-user] Move ... Kill function (File & Directory Functions)
Hans Lehmann
hans at gambas-buch.de
Sun Sep 23 16:34:51 CEST 2018
Hello Fabien,
thank you so much for your answer.
Here is the modified and verified source code:
Public Sub btnMoveKill_Click()
Dim sSourcePath, sDestinationPath, sFilename As String
sSourcePath = User.Home &/ "DW"
sDestinationPath = User.Home &/ "GB3BUCH"
sFileName = "dokuwiki_syntax.txt"
' Check whether the file to be moved exists.
If Exist(sSourcePath &/ sFileName) Then
' Now check if moveto directory exists
If Not Exist(sDestinationPath) Then
Try Mkdir sDestinationPath
If Error Then
Message.Error("Error! " & Error.Text)
Return
Endif
Endif
' Now the file is moved
Move sSourcePath &/ sFileName Kill sDestinationPath &/ sFileName
Else
Message.Error("File not exist: " & sFileName)
Return
Endif
Message.Info("File '" & sFileName & "' successfully moved!")
End
Hans
More information about the User
mailing list