HELP PLEASE PEOPLE
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Hello would like to make a application to move one file from one place to anouther but dont know how to i want to move a RAR file from dekstop/downloads ect to .minecraft texturepacks folder does anyone have and idea how to do this no ideas at all on how to move them
Code: Select all
Simple System.IO.File.Copy("File to copy","Destination to copy to")

Instead of LOL use this -
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
Don't forget to mark my answer as the correct one and please lock the thread now 

Instead of LOL use this -
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
i did it like this people just soo you know :P
Code: Select all
but when i run it it all works but says acsess is denied
Dim rName As String = My.User.Name
Dim lSlash As Integer = rName.LastIndexOf("\")
Dim fName As String = rName.Substring(lSlash + 1)
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
System.IO.File.Copy("C:\Users\" + fName+ "\AppData\Roaming\.minecraft\texturepacks", TextBox1.Text)
End Sub
Last edited by muttley1968 on Tue May 22, 2012 9:03 pm, edited 1 time in total.
Code: Select all
System.IO.File.Copy("File To Copy", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString & ".minecraft\texturepacks")

Instead of LOL use this -
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
If you get an Access Denied error, just run the app as admin 

Instead of LOL use this -
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
File.Copy does not work with folders. If you want to copy a folder you will need to list the files and copy them individually.
You could use something like this:
You could use something like this:
Code: Select all
If Not Directory.Exists(TextBox1.Text) Then
Directory.CreateDirectory(TextBox1.Text) 'destination folder
End If
Dim source As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\.minecraft\texturepacks"
Dim paths As String() = Directory.GetFiles(source)
For i As Integer = 0 To paths.Length - 1
Dim filename As String = Path.GetFileName(paths(i))
File.Copy(paths(i), TextBox1.Text & "\" & filename)
Next
i want to copy a file to a folder and when i put it
System.IO.File.Copy("File To Copy","location") layout it didnt work yet
when i switched it around it worked just fine soo
System.IO.File.Copy("File To Copy","location") layout it didnt work yet
when i switched it around it worked just fine soo
Copyright Information
Copyright © Codenstuff.com 2020 - 2023