logo  VB.Net - File Copy, Rename and Delete
This Chapter
File Attributes
Binary File
Column Header
Copy Delete ...
CSV File
File Path
Text File
Chapters
Home Page
Colours, RGB
Computer Specifications
Dates&Times
Disk Drives
Files
Folders
GPS and OS Ref
VB.Net Forms
Image Files
If & Select
List/Array
Mathematics
NuGet
Sound
String Functions
Sun and Moon
User Controls
Validation
DigitalDan Sites
My Other Sites
Contact Site

Note
Some pages
may contain
inaccuracies
Hits=5
Copy, Rename or Delete Files

Private Sub FileDelete(filename As String)
 IO.File.Delete(filename)
End Sub
'
Private Sub FileRename(oldName As String, newName As String)
 IO.File.Move(oldName, newName)
' Rename file - if new name exists then throw exception
End Sub
'
Private Sub FileRenameOverwrite(oldName As String, newName As String)
 IO.File.Move(oldName, newName, True) ' Rename file - if new name exists then overwrite it
 ' Rename file = if newName exists then overwrite newName file
End Sub
'
Private Sub FileCopy(existingName As String, newName As String)
 IO.File.Copy(existingName, newName)
 ' Copy File - if new name exists then throw exception
End Sub
'
Private Sub FileCopyOverwrite(existingName As String, newName As String)
 IO.File.Copy(existingName, newName, True) ' Copy file - if new name exists then overwrite it
 ' Copy file = if newName exists then overwrite newName file
End Sub
  

 

DigitalDan.co.uk