|
|
How to perform recursive search for files or folders in VB.net
|
Total Hit (4406) |
This is a very common requirement to find all or specific files in a specified foder and all subfolders.
You can use GetDirectories and GetFiles of System.IO.DirectoryInfo for this purpose. Check the following example.
«code LangId=2»Sub FindFilesDemo()
Dim msg As String
Dim ar As Ne
....Read More |
Rating
|
|
|
How to find and sort files based on creation time
|
Total Hit (6616) |
The following code will sort file list based on CreationTime
«code LangId=2»Option Explicit On
Option Strict On
Imports System.Collections
Imports System.IO
Module Module1
Private Class CreateTimeComparer
Implements IComparer
Public Function Compare(ByVal x
....Read More |
Rating
|
|
|
Copy Directory Content and All subfolders to target path
|
Total Hit (11367) |
This Code will copy all files and subfolders of specified source directory to target location
«code LangId=2» Sub CopyDirectory(ByVal SourcePath As String, ByVal DestPath As String, Optional ByVal Overwrite As Boolean = False)
Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourceP
....Read More |
Rating
|
|
|
|
How To Recursively Search Directories by Using Visual Basic .NET
|
Total Hit (1569) |
This article demonstrates through code how to recursively search subdirectories for files, starting with a root directory. A search string is specified so that you can search for files that match a certain criteria. Each part of the code is explained as necessary. A working code sample is also provi
....Read More |
Rating
|
|
|
How Do I...Enumerate directories and their contents?
|
Total Hit (1274) |
This sample illustrates how to use the DirectoryInfo class to create a directory listing. This is a great way to quickly list files for users or reports, or to find basic information about a specific directory. When used in combination with FileInfo, you can get all the information you need about fi
....Read More |
Rating
|
|
|
How Do I...Create a log file?
|
Total Hit (1234) |
This sample illustrates how to create a basic log file using the IO classes. This demonstration introduces many useful concepts such as writing to a file, and opening a file, even if the file does not yet exist. Since the information written to the file needs to be shown to the user, this example al
....Read More |
Rating
|
|
|
How Do I...Read and write large files?
|
Total Hit (1388) |
This sample demonstrates how to write a large file and read it back in. This sample also shows how to time such operations. It accepts a file size (measured in kilobytes) from the user, indicating the size of the file to create. The larger the specified size, the longer the process will take to both
....Read More |
Rating
|
|
|
How Do I...Read and write binary data?
|
Total Hit (1656) |
This sample illustrates basic binary file input and output using the BinaryReader, BinaryWriter and FileStream classes. A similar topic is presented under the heading How Do I...Create a log file?. Reading and writing binary information enables you to create and use files that are not accessible thr
....Read More |
Rating
|
|
|
How Do I...Watch file system changes?
|
Total Hit (717) |
Use the FileSystemWatcher component to monitor a file system and react when changes to it occur. This makes it possible for you to quickly and easily launch business processes when certain files or directories are created, modified, or deleted. For example, suppose you and a group of coworkers are c
....Read More |
Rating
|
|