同桌上课用手指进去了好爽_欧美丰满熟妇xxⅹⅹ性大i_成人av天天日天天拍拍_猛男gay帅男gay男男同志_欧美va天堂在线观看_人妻无码av中文系列三里桃花_亚欧免费无码在线观看_久久久精品国产亚洲av水_日韩在线免费看污污污_2021无码专区人妻系列日韩

首頁(yè) 優(yōu)化推廣 asp.net文件與文件夾操作類(文件刪除,創(chuàng)建,目錄刪除)

asp.net文件與文件夾操作類(文件刪除,創(chuàng)建,目錄刪除)

來(lái)源: | 時(shí)間:2013/10/30 16:16:32 |

下面這個(gè)文件操作類,可以刪除目錄并且不為空的目錄哦,也可以創(chuàng)建文件寫(xiě)文件,刪除文件以前遞歸操作目錄。

using system.io;
using system.web;

namespace sec
{
    /××////
    /// 對(duì)文件和文件夾的操作類
    ///
    public class filecontrol
    {
         public filecontrol()
         {

         }
         /××////
         /// 在根目錄下創(chuàng)建文件夾
         ///
         /// 要?jiǎng)?chuàng)建的文件路徑
         public void createfolder(string folderpathname)
         {
             if(folderpathname.trim().length> 0)
             {
                 try
                 {
                      string createpath = system.web.httpcontext.current.server.mappath("http://www.cnblogs.com/images/%22+folderpathname).tostring();
                      if(!directory.exists(createpath))
                      {
                          directory.createdirectory(createpath);
                       }
                 }
                 catch
                 {
                       throw;
                  }
             }
         }

         /××////
         /// 刪除一個(gè)文件夾下面的字文件夾和文件
         ///
         ///
         public void deletechildfolder(string folderpathname)
         {
              if(folderpathname.trim().length> 0)
              {
                   try
                   {
                         string createpath = system.web.httpcontext.current.server.mappath(folderpathname).tostring();
                         if(directory.exists(createpath))
                         {
                              directory.delete(createpath,true);
                         }
                   }
                   catch
                   {
                         throw;
                    }
             }
         }
         /××////
         /// 刪除一個(gè)文件
         ///
         public void deletefile(string filepathname)
         {
                 try
                {
                       fileinfo delefile = new fileinfo(system.web.httpcontext.current.server.mappath(filepathname).tostring());
                       delefile.delete();
                 }
                 catch
                 {

                 }
        }
        public void createfile(string filepathname)
        {
             try
             {
                  //創(chuàng)建文件夾
                  string[] strpath= filepathname.split('/');
            &nbs

服務(wù)熱線

153 8323 9821

功能和特性

價(jià)格和優(yōu)惠

網(wǎng)站和維護(hù)

推廣和優(yōu)化

微信服務(wù)號(hào)