首页 技术 正文
技术 2022年11月19日
0 收藏 860 点赞 4,380 浏览 2361 个字
 C#对磁盘IO操作的时候,经常会用到这些,路径,文件,文件名字,文件扩展名.    之前,经常用切割字符串来实现,    可是经常会弄错. 尤其是启始位置,多少个字节,经常弄晕.下面这种方法貌似比较简便:string filePath = @"E:\Randy0528\中文目录\JustTest.rar";
Response.Write("文件路径:"+filePath);
Response.Write("
更改路径字符串的扩展名。
");
Response.Write(System.IO.Path.ChangeExtension(filePath, "txt"));
Response.Write("
返回指定路径字符串的目录信息。。
");
Response.Write(System.IO.Path.GetDirectoryName(filePath));
Response.Write("
返回指定的路径字符串的扩展名。
");
Response.Write(System.IO.Path.GetExtension(filePath));
Response.Write("
返回指定路径字符串的文件名和扩展名。
");
Response.Write(System.IO.Path.GetFileName(filePath));
Response.Write("
返回不具有扩展名的指定路径字符串的文件名。
");
Response.Write(System.IO.Path.GetFileNameWithoutExtension(filePath));
Response.Write("
获取指定路径的根目录信息。
");
Response.Write(System.IO.Path.GetPathRoot(filePath));
Response.Write("
返回随机文件夹名或文件名。
");
Response.Write(System.IO.Path.GetRandomFileName());
Response.Write("
创建磁盘上唯一命名的零字节的临时文件并返回该文件的完整路径。
");
Response.Write(System.IO.Path.GetTempFileName());
Response.Write("
返回当前系统的临时文件夹的路径。
");
Response.Write(System.IO.Path.GetTempPath());
Response.Write("
确定路径是否包括文件扩展名。
");
Response.Write(System.IO.Path.HasExtension(filePath));
Response.Write("
获取一个值,该值指示指定的路径字符串是包含绝对路径信息还是包含相对路径信息。
");
Response.Write(System.IO.Path.IsPathRooted(filePath));
文件路径:E:\Randy0528\中文目录\JustTest.rar
C 文件路径、文件名、扩展名 - skyroom - lantianroom更改路径字符串的扩展名。
C 文件路径、文件名、扩展名 - skyroom - lantianroomE:\Randy0528\中文目录\JustTest.txt
C 文件路径、文件名、扩展名 - skyroom - lantianroom返回指定路径字符串的目录信息。。
C 文件路径、文件名、扩展名 - skyroom - lantianroomE:\Randy0528\中文目录
C 文件路径、文件名、扩展名 - skyroom - lantianroom返回指定的路径字符串的扩展名。
C 文件路径、文件名、扩展名 - skyroom - lantianroom.rar
C 文件路径、文件名、扩展名 - skyroom - lantianroom返回指定路径字符串的文件名和扩展名。
C 文件路径、文件名、扩展名 - skyroom - lantianroomJustTest.rar
C 文件路径、文件名、扩展名 - skyroom - lantianroom返回不具有扩展名的指定路径字符串的文件名。
C 文件路径、文件名、扩展名 - skyroom - lantianroomJustTest
C 文件路径、文件名、扩展名 - skyroom - lantianroom获取指定路径的根目录信息。
C 文件路径、文件名、扩展名 - skyroom - lantianroomE:\
C 文件路径、文件名、扩展名 - skyroom - lantianroom返回随机文件夹名或文件名。
C 文件路径、文件名、扩展名 - skyroom - lantianroomct2h5b2h.sed
C 文件路径、文件名、扩展名 - skyroom - lantianroom创建磁盘上唯一命名的零字节的临时文件并返回该文件的完整路径。
C 文件路径、文件名、扩展名 - skyroom - lantianroomC:\Documents and Settings\Randy\Local Settings\Temp\tmpAD.tmp
C 文件路径、文件名、扩展名 - skyroom - lantianroom返回当前系统的临时文件夹的路径。
C 文件路径、文件名、扩展名 - skyroom - lantianroomC:\Documents and Settings\Randy\Local Settings\Temp\
C 文件路径、文件名、扩展名 - skyroom - lantianroom确定路径是否包括文件扩展名。
C 文件路径、文件名、扩展名 - skyroom - lantianroomTrue
C 文件路径、文件名、扩展名 - skyroom - lantianroom获取一个值,该值指示指定的路径字符串是包含绝对路径信息还是包含相对路径信息。
C 文件路径、文件名、扩展名 - skyroom - lantianroomTrue
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,023
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,361
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,143
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,774
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,853