根據檔案獲取資料夾,判斷資料夾是否存在,不存在則建立
開發環境:VS2008
語言:C#
功能:根據檔案獲取檔案所在資料夾,並判斷資料夾是否存在子資料夾2
如果不存在子資料夾2,則建立
string fileName = "D:\\2\\2.txt"; string myDir = System.IO.Path.GetDirectoryName(fileName); //執行結果 //myDir為 D:\\2 string tempDir = myDir + "\\2\\"; //判斷資料夾是否存在 if (!System.IO.Directory.Exists(tempDir)) { //資料夾不存在則建立該資料夾 System.IO.Directory.CreateDirectory(tempDir); }
相關推薦
根據檔案獲取資料夾,判斷資料夾是否存在,不存在則建立
開發環境:VS2008 語言:C# 功能:根據檔案獲取檔案所在資料夾,並判斷資料夾是否存在子資料夾2 如果不存在子資料夾2,則建立 string fileName = "D:\\2\\2.txt"; string myDir = System.I
Java 判斷資料夾、檔案是否存在,不存在則建立
1、判斷檔案是否存在,不存在建立檔案 File file=new File("C:\\Users\\QPING\\Desktop\\JavaScript\\2.htm"); if(!file.exists()) { try { file.c
【C#】C#判斷檔案路徑是否存在,不存在則建立資料夾
//判斷檔案路徑是否存在,不存在則建立資料夾 if (!System.IO.Directory.Exists(@"D:\Export")) { System.IO.Directory.CreateDirectory(@"D:\Export");//不存在就建立目錄
MFC下判斷資料夾是否存在,如不存在則建立資料夾
CString strPath1,strPath2,strPath3; strPath1="D:\\處理結果\\相減"; strPath2="D:\\處理結果\\相除"; strPath3="D
oracle中根據時間獲取最新的一條資料
1、select kd.CREATEUSERID as userid,kd.LOCATION,kd.createtime as location from KT_DEVICESTRACK kd where rownum=1 order by kd.createtime 2、SELECT *
檔案路徑不存在則建立路徑,檔案存在則重新命名原檔案再建立新檔案寫入資料
String exportPath = "D:"+ File.separatorChar+new SimpleDateFormat("yyyy").format(date)+File.separatorChar +new SimpleDateFormat("MM").format(date);
c++/c新建資料夾 及判斷資料夾是否存在
通過system();函式呼叫DOS命令來建立資料夾和刪除檔案、資料夾。建立檔案可以用其檔案操作實現。 system("md c:\\mydir");//建立一個資料夾 system("rd c:\\mydir");//刪除一個資料夾 system("c:\\tes
java判斷指定路徑資料夾是否存在,若不存在則建立新的資料夾
//dirPath :資料夾磁碟路徑 private static void isChartPathExist(String dirPath) { File file = new File(dirPath); if (!file.exists()
Mybatis 實現Mysql批量插入資料,判斷資料是否存在
常見插入資料的SQL insert into 插入資料庫時會檢查主鍵是否存在,存在會報錯 replace into 替換資料庫記錄,需要表中有主鍵或者unique索引,如果資料庫已存在的資料,會先刪除該資料然後新增。不存在的資料效果和insert into
javascript中常見的函式封裝 :判斷是否是手機,判斷是否是微信,獲取url地址?後面的具體引數值,毫秒格式化時間,手機端px、rem尺寸轉換等
// 判斷是否是手機 function plat_is_mobile(){ var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var
c語言:根據輸入的分數,判斷其所在的等級,使用switch語句
#include<stdio.h> int main() { int score; char grade; printf("請輸入分數:"); scanf("%d",&score); int i; i=score/10; while(sco
Unity判斷手勢觸控的型別 ,判斷手勢的滑動方向,並獲取剛觸控以及觸控結束事的座標
本章咱們一起來看下unity對有觸控手勢做出的響應 單點觸控 Input.touchCount==1 移動觸控 Input.GetTouch(0).phase==TouchPhase.Moved 多點觸控 Input.touchCount > 1 判斷兩隻手指至少有一
根據現在的時區,判斷其他時區的時間,包含夏令時。
/*** * * @param s 所在時區 * @return 所在時區的時間 */ private String calculateTime(String s, boolean isDaylight) {
shell腳本的if語句,判斷某程序是否存在,不存在啟動該程序!
if語句 .... png div image 一個 ... 語法 新手 想必大家都知道 “如果......那麽......“ 這種語法的應用吧! 當然呢,linux下對於這種用法也是有所考慮的,很多時候我們都需要寫一個shell腳本,難免會避免if語句。 例如:判斷Apa
python,判斷操作系統是windows,linux
AS nbsp 操作 windows python bsp div pre pytho import sys,platform print(sys.platform) print(platform.system()) sys.platform: 獲取當前系統
給定一個字串,判斷它是否迴文,只考慮數字字母字元並忽略大小寫。
題幹: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. 給定一個字串,判斷它是否迴文,只
不用比較運算子,判斷int型的a,b兩數的大小 考慮溢位問題
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
Echarts統計圖,點選統計圖時,判斷點選的區域是不是統計圖區域
下面的程式碼,是獲取點選統計圖區域的,也就是 X 軸和 Y 軸中的這個框框區域,如下圖的紅色框框中。 myCharts.getZr().on('click', function (params) { const pointInPixel = [params.
【c】請輸入三個大於零的數字,判斷是否能構成三角形 ,若能,請求出三角形的面積;若不能,輸出結果。
//例3.4拓展延伸題目 //請輸入三個大於零的數字,判斷是否能構成三角形 ,若能,請求出三角形的面積;若不能,輸出結果。 #include<stdio.h> #include<math.h> int main() { double s,ar
編寫一個程式,判斷系統是big endian,還是little endian
// Endian_1.cpp : 定義控制檯應用程式的入口點。 // #include "stdafx.h" #include <stdlib.h> #include <st