码迷,mamicode.com
首页 >  
搜索关键字:判断目录    ( 87个结果
mfc判断目录是否为空
BOOL IsFolderEmpty(string path) { string str = path + "\\*.*"; CFileFind ff; BOOL bFound; bFound = ff.FindFile(str.c_str()); while (bFound) { bFound = ...
分类:编程语言   时间:2021-06-19 18:41:36    阅读次数:0
Python合集之目录操作(三)
1.判断目录是否存在 在Python中,有时需要判断给定的目录是否存在,这时可以使用os.path模块提供的exists()函数实现。 os.path.exists(path) 其中,path为要判断的目录,可以是绝对路径,也可以采用相对路径。如果给定的路径存在,则返回true,否则返回false。 ...
分类:编程语言   时间:2021-05-24 12:03:48    阅读次数:0
Python----OS 文件目录处理
import os # os.mkdir("n1") # 创建目录 # 创建文件 # with open('1.txt',mode='w') as file: # file.write('11111') # os.mknod("n1.txt") # 创建文件,windows上面不支持,linux中支 ...
分类:编程语言   时间:2021-05-04 15:43:42    阅读次数:0
Linux程序开发中如何判断目录是否为根目录?
问题引入 判断某个目录字符串是否是根目录,咋一听很简单,只要判断字符串是否是"/"即可,但是,很多情况下使用的路径是相对路径,那么如何判断相对路径是根目录呢? 思路分析 熟悉Linux的同学应该知道,每个目录下都有.和..两个目录,分别指代当前目录和父目录,考虑从这个点下手,根目录的当前目录和父目录 ...
分类:系统相关   时间:2020-11-23 12:19:15    阅读次数:14
delphi 判断目录是否存在
delphi7 if not DirectoryExists(Edit1.Text) then 判断目录是否存在 begin //判断目录不存在 end; delphi 10.3 uses FileCtrl; procedure TForm4.FormCreate(Sender: TObject); ...
分类:Windows程序   时间:2020-11-20 12:24:11    阅读次数:32
Shell总结04-测试和分支
if then/else 分支 # “[]”是调用test命令的一种形式 #文件操作 # [ -e file ] :判断文件是否存在 # [ -d dir ] :判断目录dir是否存在 # [ -b file ] :判断块设备是否存在 # [ -c file ] :判断字符设备是否存在 # [ –s ...
分类:系统相关   时间:2020-06-16 01:25:20    阅读次数:80
shell 强化1
#/bin/bash#使用date取得当前系统时间d=`date+%F`dir=/tmp/data/logs#判断目录是存在[-d$dir]||mkdir-p$direcho"$dlogs">$dir/$d.logdf-h>>$dir/$d.logfind$dir/-mtime+15|xargsrm>/dev/null2>&1
分类:系统相关   时间:2020-06-15 15:39:32    阅读次数:65
Linux shell_IF判断
数值判断#!/bin/bashNUM1=20NUM2=10if(($NUM1>$NUM2));thenecho"This$NUM1greate$NUM2!"elseecho"This$NUM1Little$NUM2!"fi判断目录是否存在,如果不存在则创建该目录#!/bin/bashDIR=/tmp/20200603if[!-d$DIR];thenmkdir-p$DIRecho-e"\033
分类:系统相关   时间:2020-06-11 00:33:04    阅读次数:72
python--os模块
1、os模块常用命令: import os①os.pathprint(os.path.join('e:','movies','a.mp4'))#拼路径,等同于"E:\\movies\\"+'a.mp4'print(os.path.exists('e:'))#判断目录/文件是否存在print(os.p ...
分类:编程语言   时间:2020-05-21 10:27:41    阅读次数:82
路径操作
python的OS模块 path属性os模块——from os import path 常用方法 from os import path p = path join('m','n') p1 = path.join('e:/a/b','c') print(type(p),p) print(type(p ...
分类:其他好文   时间:2020-05-20 20:25:21    阅读次数:75
87条   1 2 3 4 ... 9 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!