Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mports System
- Imports System.Collections.Generic
- Imports System.Globalization
- Imports System.Linq
- Imports System.Threading.Tasks
- Imports Microsoft.AspNetCore.Mvc
- Imports System.IO
- Imports Microsoft.AspNetCore.Hosting
- Imports Microsoft.AspNetCore.Http
- Imports System.Net.Mime
- Namespace API.NetCore.Controllers
- <Route("[controller]")>
- Public Class FileManagerController
- Inherits Controller
- Private ReadOnly _webRootPath As String
- Private ReadOnly _webPath As String
- Private ReadOnly _allowedExtensions As List(Of String)
- Public Sub New(ByVal env As IHostingEnvironment)
- _webPath = "ContentLibrary"
- If String.IsNullOrWhiteSpace(env.WebRootPath) Then
- env.WebRootPath = Directory.GetCurrentDirectory()
- End If
- _webRootPath = Path.Combine(env.WebRootPath, _webPath)
- _allowedExtensions = New List(Of String) From {"jpg", "jpe", "jpeg", "gif", "png", "svg", "txt", "pdf", "odp", "ods", "odt", "rtf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "csv", "ogv", "avi", "mkv", "mp4", "webm", "m4v", "ogg", "mp3", "wav", "zip", "rar", "md"}
- }
- End Sub
- Public Function Index(ByVal mode As String, ByVal path As String, ByVal name As String, ByVal files As List(Of IFormFile), ByVal old As String, ByVal [new] As String, ByVal source As String, ByVal target As String, ByVal content As String, ByVal thumbnail As Boolean, ByVal string As String) As IActionResult
- Try
- If mode Is Nothing Then
- Return Nothing
- End If
- If Not String.IsNullOrWhiteSpace(path) AndAlso path.StartsWith("/") Then path = path.Substring(1)
- If Not String.IsNullOrWhiteSpace([new]) AndAlso [new].StartsWith("/") Then [new] = If([new] = "/", String.Empty, [new].Substring(1))
- If Not String.IsNullOrWhiteSpace(source) AndAlso source.StartsWith("/") Then source = source.Substring(1)
- If Not String.IsNullOrWhiteSpace(target) AndAlso target.StartsWith("/") Then target = target.Substring(1)
- Select Case mode.ToLower(CultureInfo.CurrentCulture)
- Case "initiate"
- Return Json(Initiate())
- Case "getinfo"
- Return Json(GetInfo(path))
- Case "readfolder"
- Return Json(ReadFolder(path))
- Case "addfolder"
- Return Json(AddFolder(path, name))
- Case "upload"
- Return Json(Upload(path, files).Result)
- Case "rename"
- Return Json(Rename(old, [new]))
- Case "move"
- Return Json(Move(old, [new]))
- Case "copy"
- Return Json(Copy(source, target))
- Case "savefile"
- Return Json(SaveFile(path, content))
- Case "delete"
- Return Json(Delete(path))
- Case "download"
- Return Download(path)
- Case "getimage"
- Return GetImage(path, thumbnail)
- Case "readfile"
- Return ReadFile(path)
- Case "summarize"
- Return Json(Summarize())
- Case "seekfolder"
- Return Json(SeekFolder(path, string))
- End Select
- Throw New Exception("Unknown Request!")
- Catch e As Exception
- Return New JsonResult(e.Message) With {
- .StatusCode = StatusCodes.Status500InternalServerError,
- .ContentType = "application/json"
- }
- End Try
- End Function
- Private Function Initiate() As dynamic
- Dim result = New With {Key
- .Data = New With {Key
- .Type = "initiate", Key
- .Attributes = New With {Key
- .Config = New With {Key
- .Security = New With {Key
- .[ReadOnly] = False, Key
- .Extensions = New With {Key
- .IgnoreCase = True, Key
- .Policy = "ALLOW_LIST", Key
- .Restrictions = _allowedExtensions
- }
- }
- }
- }
- }
- }
- Return result
- End Function
- Private Function GetUnixTimestamp(ByVal dt As DateTime) As Int32
- Return CInt((dt.ToUniversalTime().Subtract(New DateTime(1970, 1, 1))).TotalSeconds)
- End Function
- Private Function SeekFolder(ByVal path As String, ByVal search As String) As dynamic
- If path Is Nothing Then
- path = String.Empty
- End If
- Dim searchPath = Path.Combine(_webRootPath, path)
- Dim data = New List(Of dynamic)()
- For Each file As FileInfo In New DirectoryInfo(searchPath).GetFiles("*" & search & "*", SearchOption.AllDirectories)
- Dim item = New With {Key
- .Id = MakeWebPath(Path.Combine(Path.GetRelativePath(_webRootPath, file.DirectoryName), file.Name), True), Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = file.Name, Key
- .Path = MakeWebPath(Path.Combine(Path.GetRelativePath(_webRootPath, file.DirectoryName), file.Name), True), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(file.CreationTimeUtc), Key
- .Modified = GetUnixTimestamp(file.LastWriteTimeUtc), Key
- .Size = file.Length, Key
- .Extension = file.Extension.TrimStart("."c), Key
- .Timestamp = DateTime.Now.Subtract(file.LastWriteTime).TotalSeconds
- }
- }
- data.Add(item)
- Next
- For Each dir As DirectoryInfo In New DirectoryInfo(searchPath).GetDirectories("*" & search & "*", SearchOption.AllDirectories)
- Dim item = New With {Key
- .Id = MakeWebPath(Path.GetRelativePath(_webRootPath, dir.FullName), False, True), Key
- .Type = "folder", Key
- .Attributes = New With {Key
- .Name = dir.Name, Key
- .Path = MakeWebPath(dir.FullName, True, True), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(dir.CreationTimeUtc), Key
- .Modified = GetUnixTimestamp(dir.LastWriteTimeUtc), Key
- .Timestamp = DateTime.Now.Subtract(dir.LastWriteTime).TotalSeconds
- }
- }
- data.Add(item)
- Next
- Return New With {Key
- .Data = data
- }
- End Function
- Private Function GetInfo(ByVal path As String) As dynamic
- If path Is Nothing Then
- path = String.Empty
- End If
- Dim filePath = Path.Combine(_webRootPath, path)
- Dim file As FileInfo = New FileInfo(path)
- Return New With {Key
- .Data = New With {Key
- .Id = MakeWebPath(Path.Combine(Path.GetRelativePath(_webRootPath, file.DirectoryName), file.Name), True), Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = file.Name, Key
- .Path = MakeWebPath(Path.Combine(Path.GetRelativePath(_webRootPath, file.DirectoryName), file.Name), False), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(file.CreationTimeUtc), Key
- .Modified = GetUnixTimestamp(file.LastWriteTimeUtc), Key
- .Size = file.Length, Key
- .Extension = file.Extension.TrimStart("."c), Key
- .Timestamp = DateTime.Now.Subtract(file.LastWriteTime).TotalSeconds
- }
- }
- }
- End Function
- Private Function ReadFolder(ByVal path As String) As dynamic
- If path Is Nothing Then path = String.Empty
- Dim rootpath = Path.Combine(_webRootPath, path)
- Dim rootDirectory = New DirectoryInfo(rootpath)
- Dim data = New List(Of dynamic)()
- For Each directory In rootDirectory.GetDirectories()
- Dim item = New With {Key
- .Id = MakeWebPath(Path.Combine(path, directory.Name), False, True), Key
- .Type = "folder", Key
- .Attributes = New With {Key
- .Name = directory.Name, Key
- .Path = MakeWebPath(Path.Combine(_webPath, path, directory.Name), True, True), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(directory.CreationTime), Key
- .Modified = GetUnixTimestamp(directory.LastWriteTime), Key
- .Timestamp = DateTime.Now.Subtract(directory.LastWriteTime).TotalSeconds
- }
- }
- data.Add(item)
- Next
- For Each file In rootDirectory.GetFiles()
- Dim item = New With {Key
- .Id = MakeWebPath(Path.Combine(path, file.Name)), Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = file.Name, Key
- .Path = MakeWebPath(Path.Combine(_webPath, path, file.Name), True), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(file.CreationTime), Key
- .Modified = GetUnixTimestamp(file.LastWriteTime), Key
- .Extension = file.Extension.Replace(".", ""), Key
- .Size = file.Length, Key
- .Timestamp = DateTime.Now.Subtract(file.LastWriteTime).TotalSeconds
- }
- }
- data.Add(item)
- Next
- Dim result = New With {Key
- .Data = data
- }
- Return result
- End Function
- Private Function AddFolder(ByVal path As String, ByVal name As String) As dynamic
- Dim newDirectoryPath = Path.Combine(_webRootPath, path, name)
- Dim directoryExist = Directory.Exists(newDirectoryPath)
- If directoryExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "DIRECTORY_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- name
- }
- }
- })
- Return errorResult
- End If
- Directory.CreateDirectory(newDirectoryPath)
- Dim directory = New DirectoryInfo(newDirectoryPath)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = MakeWebPath(Path.Combine(path, directory.Name), False, True), Key
- .Type = "folder", Key
- .Attributes = New With {Key
- .Name = directory.Name, Key
- .Path = MakeWebPath(Path.Combine(_webPath, path, directory.Name), True, True), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- End Function
- Private Async Function Upload(ByVal path As String, ByVal files As IEnumerable(Of IFormFile)) As Task(Of dynamic)
- Dim result = New With {Key
- .Data = New List(Of dynamic)()
- }
- For Each file In files
- If file.Length <= 0 Then Continue For
- Dim fileExist = System.IO.File.Exists(Path.Combine(_webRootPath, path, file.FileName))
- If fileExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "FILE_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- file.FileName
- }
- }
- })
- Return errorResult
- End If
- Using fileStream = New FileStream(Path.Combine(_webRootPath, path, file.FileName), FileMode.Create)
- Await file.CopyToAsync(fileStream)
- End Using
- result.Data.Add(New With {Key
- .Id = MakeWebPath(Path.Combine(path, file.FileName)), Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = file.FileName, Key
- .Extension = Path.GetExtension(file.FileName).Replace(".", ""), Key
- .Path = MakeWebPath(Path.Combine(_webPath, path, file.FileName), True), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now), Key
- .Size = file.Length
- }
- })
- Next
- Return result
- End Function
- Private Function Rename(ByVal old As String, ByVal [new] As String) As dynamic
- Dim oldPath = Path.Combine(_webRootPath, old)
- Dim fileAttributes = System.IO.File.GetAttributes(oldPath)
- If (fileAttributes And FileAttributes.Directory) = FileAttributes.Directory Then
- Dim oldDirectoryName = Path.GetDirectoryName(old).Split("\"c).Last()
- Dim newDirectoryPath = old.Replace(oldDirectoryName, [new])
- Dim newPath = Path.Combine(_webRootPath, newDirectoryPath)
- Dim directoryExist = Directory.Exists(newPath)
- If directoryExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "DIRECTORY_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- [new]
- }
- }
- })
- Return errorResult
- End If
- Directory.Move(oldPath, newPath)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = newDirectoryPath, Key
- .Type = "folder", Key
- .Attributes = New With {Key
- .Name = [new], Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- Else
- Dim oldFileName = Path.GetFileName(old)
- Dim newFilePath = old.Replace(oldFileName, [new])
- Dim newPath = Path.Combine(_webRootPath, newFilePath)
- Dim fileExist = System.IO.File.Exists(newPath)
- If fileExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "FILE_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- [new]
- }
- }
- })
- Return errorResult
- End If
- System.IO.File.Move(oldPath, newPath)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = newFilePath, Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = [new], Key
- .Extension = Path.GetExtension(newPath).Replace(".", ""), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- End If
- End Function
- Private Function Move(ByVal old As String, ByVal [new] As String) As dynamic
- Dim fileAttributes = System.IO.File.GetAttributes(Path.Combine(_webRootPath, old))
- If (fileAttributes And FileAttributes.Directory) = FileAttributes.Directory Then
- Dim directoryName = Path.GetDirectoryName(old).Split("\"c).Last()
- Dim newDirectoryPath = Path.Combine([new], directoryName)
- Dim oldPath = Path.Combine(_webRootPath, old)
- Dim newPath = Path.Combine(_webRootPath, [new], directoryName)
- Dim directoryExist = Directory.Exists(newPath)
- If directoryExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "DIRECTORY_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- directoryName
- }
- }
- })
- Return errorResult
- End If
- Directory.Move(oldPath, newPath)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = newDirectoryPath, Key
- .Type = "folder", Key
- .Attributes = New With {Key
- .Name = directoryName, Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- Else
- Dim fileName = Path.GetFileName(old)
- Dim newFilePath = Path.Combine([new], fileName)
- Dim oldPath = Path.Combine(_webRootPath, old)
- Dim newPath = If([new] = "/", Path.Combine(_webRootPath, fileName.Replace("/", "")), Path.Combine(_webRootPath, [new], fileName))
- Dim fileExist = System.IO.File.Exists(newPath)
- If fileExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "FILE_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- fileName
- }
- }
- })
- Return errorResult
- End If
- System.IO.File.Move(oldPath, newPath)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = newFilePath, Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = fileName, Key
- .Extension = Path.GetExtension([new]).Replace(".", ""), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- End If
- End Function
- Private Function Copy(ByVal source As String, ByVal target As String) As dynamic
- Dim fileAttributes = System.IO.File.GetAttributes(Path.Combine(_webRootPath, source))
- If (fileAttributes And FileAttributes.Directory) = FileAttributes.Directory Then
- Dim directoryName = Path.GetDirectoryName(source).Split("\"c).Last()
- Dim newDirectoryPath = Path.Combine(target, directoryName)
- Dim oldPath = Path.Combine(_webRootPath, source)
- Dim newPath = Path.Combine(_webRootPath, target, directoryName)
- Dim directoryExist = Directory.Exists(newPath)
- If directoryExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "DIRECTORY_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- directoryName
- }
- }
- })
- Return errorResult
- End If
- DirectoryCopy(oldPath, newPath)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = newDirectoryPath, Key
- .Type = "folder", Key
- .Attributes = New With {Key
- .Name = directoryName, Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- Else
- Dim fileName = Path.GetFileName(source)
- Dim newFilePath = Path.Combine(target, fileName)
- Dim oldPath = Path.Combine(_webRootPath, source)
- Dim newPath = Path.Combine(_webRootPath, target, fileName)
- Dim fileExist = System.IO.File.Exists(newPath)
- If fileExist Then
- Dim errorResult = New With {Key
- .Errors = New List(Of dynamic)()
- }
- errorResult.Errors.Add(New With {Key
- .Code = "500", Key
- .Title = "FILE_ALREADY_EXISTS", Key
- .Meta = New With {Key
- .Arguments = New List(Of String) From {
- fileName
- }
- }
- })
- Return errorResult
- End If
- System.IO.File.Copy(oldPath, newPath)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = newFilePath, Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = fileName, Key
- .Extension = Path.GetExtension(fileName).Replace(".", ""), Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- End If
- End Function
- Private Function SaveFile(ByVal path As String, ByVal content As String) As dynamic
- Dim filePath = Path.Combine(_webRootPath, path)
- System.IO.File.WriteAllText(filePath, content)
- Dim fileName = Path.GetFileName(path)
- Dim fileExtension = Path.GetExtension(fileName)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = path, Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = fileName, Key
- .Extension = fileExtension, Key
- .Readable = 1, Key
- .Writable = 1
- }
- }
- }
- Return result
- End Function
- Private Function Delete(ByVal path As String) As dynamic
- Dim fileAttributes = System.IO.File.GetAttributes(Path.Combine(_webRootPath, path))
- If (fileAttributes And FileAttributes.Directory) = FileAttributes.Directory Then
- Dim directoryName = Path.GetDirectoryName(path).Split("\"c).Last()
- Directory.Delete(Path.Combine(_webRootPath, path), True)
- Dim result = New With {Key
- .Data = New With {Key
- .Id = path, Key
- .Type = "folder", Key
- .Attributes = New With {Key
- .Name = directoryName, Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now), Key
- .Path = path
- }
- }
- }
- Return result
- Else
- Dim fileName = Path.GetFileName(Path.Combine(_webRootPath, path))
- Dim fileExtension = Path.GetExtension(fileName).Replace(".", "")
- System.IO.File.Delete(Path.Combine(_webRootPath, path))
- Dim result = New With {Key
- .Data = New With {Key
- .Id = path, Key
- .Type = "file", Key
- .Attributes = New With {Key
- .Name = fileName, Key
- .Extension = fileExtension, Key
- .Readable = 1, Key
- .Writable = 1, Key
- .Created = GetUnixTimestamp(DateTime.Now), Key
- .Modified = GetUnixTimestamp(DateTime.Now)
- }
- }
- }
- Return result
- End If
- End Function
- Private Function ReadFile(ByVal path As String) As dynamic
- Dim filePath = Path.Combine(_webRootPath, path)
- Dim fileName = Path.GetFileName(filePath)
- Dim fileBytes As Byte() = System.IO.File.ReadAllBytes(filePath)
- Dim cd = New ContentDisposition With {
- .Inline = True,
- .FileName = fileName
- }
- Response.Headers.Add("Content-Disposition", cd.ToString())
- Return File(fileBytes, "application/octet-stream")
- End Function
- Private Function GetImage(ByVal path As String, ByVal thumbnail As Boolean) As IActionResult
- Dim filePath = Path.Combine(_webRootPath, path)
- Dim fileName = Path.GetFileName(filePath)
- Dim fileBytes As Byte() = System.IO.File.ReadAllBytes(filePath)
- Dim cd = New ContentDisposition With {
- .Inline = True,
- .FileName = fileName
- }
- Response.Headers.Add("Content-Disposition", cd.ToString())
- Return File(fileBytes, "image/*")
- End Function
- Private Function Download(ByVal path As String) As dynamic
- Dim filePath = Path.Combine(_webRootPath, path)
- Dim fileName = Path.GetFileName(filePath)
- Dim fileBytes As Byte() = System.IO.File.ReadAllBytes(filePath)
- Return File(fileBytes, "application/x-msdownload", fileName)
- End Function
- Private Function Summarize() As dynamic
- Dim directories = Directory.GetDirectories(_webRootPath, "*", SearchOption.AllDirectories).Length
- Dim directoryInfo = New DirectoryInfo(_webRootPath)
- Dim files = directoryInfo.GetFiles("*", SearchOption.AllDirectories)
- Dim allSize = files.[Select](Function(f) f.Length).Sum()
- Dim result = New With {Key
- .Data = New With {Key
- .Id = "/", Key
- .Type = "summary", Key
- .Attributes = New With {Key
- .Size = allSize, Key
- .Files = files.Length, Key
- .Folders = directories, Key
- .SizeLimit = 0
- }
- }
- }
- Return result
- End Function
- Private Shared Sub DirectoryCopy(ByVal sourceDirName As String, ByVal destDirName As String)
- Dim dir = New DirectoryInfo(sourceDirName)
- If Not dir.Exists Then
- Throw New DirectoryNotFoundException("Source directory does not exist or could not be found: " & sourceDirName)
- End If
- Dim dirs = dir.GetDirectories()
- If Not Directory.Exists(destDirName) Then
- Directory.CreateDirectory(destDirName)
- End If
- Dim files = dir.GetFiles()
- For Each file In files
- Dim temppath = Path.Combine(destDirName, file.Name)
- file.CopyTo(temppath, False)
- Next
- For Each subdir In dirs
- Dim temppath = Path.Combine(destDirName, subdir.Name)
- DirectoryCopy(subdir.FullName, temppath)
- Next
- End Sub
- Private Shared Function MakeWebPath(ByVal path As String, ByVal Optional addSeperatorToBegin As Boolean = False, ByVal Optional addSeperatorToLast As Boolean = False) As String
- path = path.Replace("\", "/")
- If addSeperatorToBegin Then path = "/" & path
- If addSeperatorToLast Then path = path & "/"
- Return path
- End Function
- End Class
- End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement