.net下创建文件夹
我准备在系统里通过触发复选框,在本地磁盘里自动创建一个物理文件夹如C:/asp,当这个文件夹存在且有文件时,能否将其自动覆盖,这个要怎么编译呀?还是先查看是否有这个文件夹,如果有删除,如果没有新建???我这里有两个程序段
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateFolder("c:\asp")
set f=nothing
set fs=nothing
%>
删除的可以用 DeleteFolder
该怎么实现呢?本人刚接触编程,边学边做,望大家帮帮忙!谢谢!!! --------------------编程问答-------------------- 看看IO把! --------------------编程问答-------------------- Dim path As String = "c:\文件夹"
Try
' Determine whether the directory exists.
If Directory.Exists(path) Then
Console.WriteLine("That path exists already.")
Return
End If
' Try to create the directory.
Dim di As DirectoryInfo = Directory.CreateDirectory(path)
Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(path))
' Delete the directory.
di.Delete()
Console.WriteLine("The directory was deleted successfully.")
Catch e As Exception
Console.WriteLine("The process failed: {0}.", e.ToString())
End Try
--------------------编程问答-------------------- System.IO.DirectoryInfo --------------------编程问答-------------------- 在asp中能实现吗 --------------------编程问答-------------------- 可以,网上有示例
补充:.NET技术 , ASP.NET