Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Vb.net] Write folder with files from resource to..

[Vb.net] Write folder with files from resource to..

Posts 1–15 of 24 · Page 1 of 2
PP
ppl2pass
[Vb.net] Write folder with files from resource to..
How would you write a folder containing several files from resources to my usb using vb.net?
#1 · 16y ago
Blubb1337
Blubb1337
Code:
 Public Sub MoveFiles(ByVal sourcePath As String, ByVal DestinationPath As String)
        If (Directory.Exists(sourcePath)) Then
            For Each fName As String In Directory.GetFiles(sourcePath)
                If File.Exists(fName) Then
                    Dim dFile As String = String.Empty
                    dFile = Path.GetFileName(fName)
                    Dim dFilePath As String = String.Empty
                    dFilePath = DestinationPath + dFile
                    File.Move(fName, dFilePath)
                End If
            Next
        End If
    End Sub
#2 · 16y ago
PP
ppl2pass
alright thanks man.

how can i check if a folder is already in there?

so if a file called "private" is already in my documents, it will not make a new file called "private".
#3 · 16y ago
Blubb1337
Blubb1337
If Not File.Exists(Path) Then
'whatever
End if
#4 · 16y ago
PP
ppl2pass
ok thanks man.

last question, how do you delete a folder and all its content inside?
#5 · 16y ago
Blubb1337
Blubb1337
Code:
Public Sub DeleteFilesFromFolders(ByVal sourcePath As String)
        If (Directory.Exists(DirPath)) Then
            For Each fName As String In Directory.GetFiles(DirPath)
                If File.Exists(fName) Then
                    File.Delete(fName)
                End If
            Next
        End If
    End Sub
#6 · 16y ago
PP
ppl2pass
I need ur help guys.
I have a slight problem.

When i use this code
Code:
  Dim RPath As String = Application.StartupPath & "\File.exe" 'File.exe will be a  temp name given to your exe, you can make it anything you want, or keep it as is.
 
' Will create the file with the given name
            Using CreateFile As New FileStream(RPath, FileMode.Create)
                CreateFile.Write(My.Resources.YourResource, 0, My.Resources.YourResource.Length)
            End Using
This would not work for .png or .xml files. It said something about a 1-dimensional array or something.
#7 · 16y ago
Hassan
Hassan
Quote Originally Posted by ppl2pass View Post
I need ur help guys.
I have a slight problem.

When i use this code
Code:
  Dim RPath As String = Application.StartupPath & "\File.exe" 'File.exe will be a  temp name given to your exe, you can make it anything you want, or keep it as is.
 
' Will create the file with the given name
            Using CreateFile As New FileStream(RPath, FileMode.Create)
                CreateFile.Write(My.Resources.YourResource, 0, My.Resources.YourResource.Length)
            End Using
This would not work for .png or .xml files. It said something about a 1-dimensional array or something.
Try this:

Dim RPath As String = Application.StartupPath & "\File.png"
Dim i As System.Text.Encoding = System.Text.Encoding.ASCII
Using CreateFile As New FileStream(RPath,FileMode.Create)
CreateFile.Write(i.GetBytes(RPath),0,i.GetByteCoun t(RPath))
End Using
#8 · 16y ago
Zoom
Zoom
Quote Originally Posted by ppl2pass View Post
I need ur help guys.
I have a slight problem.

When i use this code
Code:
  Dim RPath As String = Application.StartupPath & "\File.exe" 'File.exe will be a  temp name given to your exe, you can make it anything you want, or keep it as is.
 
' Will create the file with the given name
            Using CreateFile As New FileStream(RPath, FileMode.Create)
                CreateFile.Write(My.Resources.YourResource, 0, My.Resources.YourResource.Length)
            End Using
This would not work for .png or .xml files. It said something about a 1-dimensional array or something.
[php] Dim myFile() As Byte = My.Resources.FilenameHere

Dim fileData = New FileStream("\ProgramFiles\Filenamehere.png", FileMode.OpenOrCreate)
Dim BW As New BinaryWriter(fileData)
Try
For bt As Integer = 0 To myFile.Length - 1
BW.Write(myFile(bt))
Next
Catch ex As Exception
MsgBox(ex)
Finally
fileData.Close()
BW.Close()

End Try[/php]

Should work on any file.
#9 · 16y ago
PP
ppl2pass
flames for your code does it even read the file from my resources?
#10 · 16y ago
Hassan
Hassan
Quote Originally Posted by ppl2pass View Post
flames for your code does it even read the file from my resources?
No, I just solved the encoding problem. I thought that it would write the file. But forgot about the source file. Anyways it can be done with this method too. As Hejsan's code solved your problem, I think there's no need for me to write that now.
#11 · 16y ago
PP
ppl2pass
hejan's code did not work. i still had the same problem... your code needs a bit of fixing but i dont know how to do it.
#12 · 16y ago
Hassan
Hassan
Quote Originally Posted by ppl2pass View Post
hejan's code did not work. i still had the same problem... your code needs a bit of fixing but i dont know how to do it.
OK, the first thing:

Why you need to write the png file this way. Can't you directly copy the file to the specified target ? Or is there a problem in that ??
#13 · 16y ago
PP
ppl2pass
how can you copy it? i never tried it.
#14 · 16y ago
Hassan
Hassan
Quote Originally Posted by ppl2pass View Post
how can you copy it? i never tried it.
Dim FileToCopy As String = "C:\Documents and Settings\FlameXaber\My Documents\My Pictures\kristen\k1.jpg"

Dim DestinationFile As String = Application.StartupPath & "\File.jpg"

My.Computer.FileSystem.CopyFile(FileToCopy,Destina tionFile, True )


This will copy the file the specified image to the specified location.
#15 · 16y ago
Posts 1–15 of 24 · Page 1 of 2

Post a Reply

Similar Threads

  • [SOURCE CODE]Write File To Disk From Resources[VB.NET]By ajvpot in Combat Arms Hack Coding / Programming / Source Code
    2Last post 16y ago
  • how to save dll from resources to temp folder.? [solved]By blackgaming in Visual Basic Programming
    2Last post 15y ago
  • Extract Audio files from BC2 folderBy gano95 in Battlefield Bad Company 2 (BFBC2) Hacks
    3Last post 16y ago
  • Problem with paint.net and moding DTX filesBy dehpwner in Combat Arms Help
    6Last post 16y ago
  • is it safe to delete files from Temp folder found in Local settings?By thechewu in General
    13Last post 19y ago

Tags for this Thread

None