CoderZone.org

Category: >> ASP/VB Code >> Copy a file in VB Bookmark and Share

<< lastnext >>

Snippet Name: Copy a file in VB

Description: A clear example of how to copy a file in Visual Basic. Doesn't get much easier than this!

Also see:
» Write or update an htpasswd file i...
» Validate file extensions in upload...
» Javascript Include - allows dynami...
» Remove empty lines from a string o...
» Automatically find location of jav...
» Remove empty lines from text files
» Delete a file in Visual Basic
» Copy a folder in Visual Basic
» Reading and Writing to text files ...
» Parsing PHP in Javascript Files
» Perl version of file_get_contents&...
» Read the contents of an entire fil...
» Create an array from the lines of ...
» Remove Duplicate Lines from a File
» Extract Just The BODY Of An HTML F...
» Rename Files Interactively
» Sort A File List By Month Name In ...
» Get File Size Over HTTP
» Get A Directory Listing Of Specifi...
» Check If A Directory Allows File C...
» Copy Files By Date Modified
» Output To STDOUT Or A File
» Include All Files In A Directory
» More File Type Detection in PHP
» Copy a remote file to your site
» Use htpasswd file with PHPscripts
» TABLESPACE: List tablespaces, fil...
» TABLESPACE: Tempfile operations
» Get file extension

Comment: (none)

Author:
Language: VB
Highlight Mode: VB
Last Modified: December 09th, 2010

' copy a file 
Set fso = CreateObject("Scripting.FileSystemObject")
Set myFile = fso.CreateTextFile(".\testfile.txt", True)
myFile.WriteLine("1234")
Set myFile = fso.GetFile(".\testfile.txt")
myFile.Copy("./output.bak")
 
' an alternate way to do it
fso.CopyFile "c:\mydir\*.*", "d:\homedir\",TRUE
 
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 9