首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏方球

    golang filepath (路径工具)

    Abs 获取绝对路径 func Abs(path string) (string, error) pathAbs, _ := filepath.Abs("./") fmt.Println Rel 返回一个路径的相对路径 func Rel(basepath, targpath string) (string, error) fmt.Println(filepath.Rel(". /static 表示从 file指向 static 的相对路径 // 注意;路径内不能包含文件 // 当路径末尾包含文件 fmt.Println(filepath.Rel(". \static.js VolumeName 获取开头卷名 func VolumeName(path string) (v string) pathAbs, _ := filepath.Abs(" ./") fmt.Println(filepath.VolumeName(pathAbs)) // -> C: Walk 遍历目录树,并执行回调, 类似 map 报错或遍历结束,跳出

    1.2K20发布于 2019-08-23
  • 来自专栏笨兔儿

    Golang-filepath使用

    Golang-filepath 使用 获取当前目录 os.GetPWD() filepath.Abs(path) # 绝对目录 filepath.Dir(path) # 相对目录 可以 filepath.Abs (filepath.Dir(path)) 获取字符目录,前缀,后缀等方法 filepath.Split(path) filepath.Base(path) # test.txt filepath.Ext

    59320发布于 2019-05-26
  • 来自专栏Hank’s Blog

    python FileNotFoundError: for getsize(filepath)

    if not any(fileEx in item for item in exclude): print(fileName) filePath = os.path.join(root,fileName) fileSize = getsize(filePath) files_size os.stat(filename).st_size FileNotFoundError: [WinError 3] The system cannot find the path specified: 解决: filePath \\" + filePath fileSize = getsize(filePath)

    1.8K30发布于 2020-09-17
  • 来自专栏星辰SEA

    MySQL 报 Cant start server: cant check PID filepath: No such file or directory

    或者 [ERROR] Can’t start server: can’t create PID filepath: No such file or directory 错误原因 一般是由于服务器强制关机导致

    2K40编辑于 2022-10-29
  • 来自专栏yanlongli_艳龙

    git merge error: add_cacheinfo failed to refresh for path filePath; merge aborting.

    合并一个开发比较久的分支到master。 使用的命令: git checkout master git merge may_dev_branch

    1.3K10编辑于 2021-12-16
  • 来自专栏猫头虎博客专区

    最全的Excel导入导出实战(通用版), 注解+反射 优雅的实现

    ); 指定读取 下面是学生表.xlsx中Sheet1,Sheet2的数据 获取Sheet1表头以下的信息 String filePath = "/home/chenmingjian/Downloads/ (filePath); 指定读取 String filePath = "/home/chenmingjian/Downloads/学生表.xlsx"; Sheet sheet = new Sheet(1 return readLessThan1000RowBySheet(filePath,null); } /** * 读小于1000行数据, 带样式 * filePath 文件绝对路径 StringUtils.hasText(filePath)){ return null; } sheet = sheet != null ? return readMoreThan1000RowBySheet(filePath,null); } /** * 读大于1000行数据, 带样式 * @param filePath

    2.2K20编辑于 2024-04-08
  • 来自专栏bisal的个人杂货铺

    Java文件写入的6种方法

    * @param content 待写入内容 * @throws IOException */ public static void fileWriterMethod(String filepath , String content) throws IOException { try (FileWriter fileWriter = new FileWriter(filepath)) { , String content) throws IOException { Files.write(Paths.get(filepath), content.getBytes()); } = "/Users/mac/Downloads/io_test/write1.txt"; final String filepath2 = "/Users/mac/Downloads final String filepath4 = "/Users/mac/Downloads/io_test/write4.txt"; final String filepath5 =

    3K20发布于 2021-11-01
  • 来自专栏Golang语言社区

    Golang语言中Path包用法

    操作 fmt.Println("FilePath操作-----------------") fmt.Println(filepath.IsAbs("c:\\wind\\aa\\bb\\b.txt") fmt.Println(filepath.Clean("aa/c\\baa.exe")) //aa\c\baa.exe fmt.Println(filepath.Dir //path.exe <nil> fmt.Println(filepath.Ext(". fmt.Println(filepath.HasPrefix("c:\\aa\\bb", "c:\\")) //true fmt.Println(filepath.IsAbs ] filepath.Walk("../..

    1.2K90发布于 2018-03-21
  • 来自专栏Golang语言社区

    Golang语言中Path包用法

    操作 fmt.Println("FilePath操作-----------------") fmt.Println(filepath.IsAbs("c:\\wind\\aa\\bb\\b.txt") fmt.Println(filepath.Clean("aa/c\\baa.exe")) //aa\c\baa.exe fmt.Println(filepath.Dir //path.exe <nil> fmt.Println(filepath.Ext(". fmt.Println(filepath.HasPrefix("c:\\aa\\bb", "c:\\")) //true fmt.Println(filepath.IsAbs ] filepath.Walk("../..

    79670发布于 2018-03-26
  • 来自专栏python基础文章

    Python编程自动化办公案例(2)

    in all_filename: # print(filepath) filepath = path + filepath print(filepath) #C:\Users for filepath in all_filename: # print(filepath) filepath = path +"\\" +filepath print(filepath (5)链路拼接 for filepath in all_filename: #链路拼接: filepath=os.path.join(path,filepath) print( in all_filename: #链路拼接: filepath=os.path.join(path,filepath) print(filepath) #链路拼接 : filepath=os.path.join(path,filepath) all_filepath.append(filepath) print(all_filepath)

    41140编辑于 2023-10-15
  • 来自专栏coding...

    Objective-C NSFileManager的使用 各种文件操作所有方法具体实现

    ; //写文件-字典 - (BOOL)writeDict:(NSDictionary*)dict inFilePath:(NSString*)filePath ; //写文件-数组 - (BOOL)writeArray :(NSArray*)array inFilePath:(NSString*)filePath ; //读文件 - (NSString*)readFileAt:(NSString*)filePath; long long)computerDirSizeAtPath:(NSString*)dirPath; //删除文件 - (BOOL)removeFileAtPath:(NSString*)filePath = [path stringByAppendingPathComponent:newDirName]; if ([self.manager fileExistsAtPath:filePath] [self.manager fileExistsAtPath:filePath]) { BOOL isCreate = [self.manager createFileAtPath:filePath

    1K30发布于 2018-08-23
  • 来自专栏全栈程序员必看

    ALLuxio_Alluxio公司怎么样

    * 文件路径 */ public static void unmount(String filePath) { // 1.创建文件路径 AlluxioURI AlluxioURI (String filePath) { return openFile(filePath, OpenFileOptions.defaults().setReadType(ReadType.CACHE_PROMOTE 文件的内容 */ public static List<String> openFileNoCacheReadType(String filePath) { return openFile(filePath (String filePath) { return openFile(filePath, OpenFileOptions.defaults().setReadType(ReadType.CACHE)) static List<String> openFileDefalutReadType(String filePath) { return openFile(filePath, OpenFileOptions.defaults

    2.1K40编辑于 2022-11-03
  • 来自专栏技术博文

    Java文件操作编程

    static void createFile() { String dir = System.getProperty("user.dir"); String filePath in = new FileInputStream(new File(filePath1)); OutputStream out = new FileOutputStream(new File(filePath2)); byte[] buf = new byte[1024]; int len; while (( = dir + "/info2.log"; File file = new File(filePath); if (! = dir + "/info4.log"; File file = new File(filePath); System.out.println(file.exists

    48610编辑于 2021-12-24
  • 来自专栏优质文章

    设计模式---代理模式

    (map.containsKey(filePath)) { return map.get(filePath); } // 模拟文件下载,睡个10秒 (filePath); map.put(filePath, res); return res; }} public class YoutubeDownloader implements (filePath); map.put(filePath, res); return res; }}客户端的使用案例如下。 (filePath); map.put(filePath, res); return res; }} public class YoutubeDownloader implements (filePath); map.put(filePath, res); return res; }}在客户端调用时,引入Java反射,通过反射创建具体的代理对象。

    33720编辑于 2022-11-08
  • 来自专栏FHADMIN

    java 文件处理 工具类

    文件完整路径,包括文件名 * @return */ public static Double getFilesize(String filepath){ File backupath = new File(filepath); return Double.valueOf(backupath.length())/1000.000; } /** * 创建目录 * @param = filePathAndName; filePath = filePath.toString(); java.io.File myDelFile = new java.io.File(filePath { File f = new File(filePath); if (! IOException { File f = new File(filePath); if (!

    90420发布于 2021-09-30
  • 来自专栏全栈程序员必看

    获取当前jar包路径_java获取jar文件

    的结果应当是该可运行jar包的绝对路径, * 此时我们只需要经过字符串解析,便可得到jar所在目录 */ if(filePath.contains(pathSplit)){ filePath = filePath.substring(0,filePath.indexOf(pathSplit)); }else if (filePath.endsWith(".jar")) { //截取路径中的 jar包名,可执行jar包运行的结果里包含".jar" filePath = filePath.substring(0, filePath.lastIndexOf(File.separator) (".jar")) { // 可执行jar包运行的结果里包含".jar" // 获取jar包所在目录 filePath = filePath.substring(0, filePath.lastIndexOf ("/") + 1); } File file = new File(filePath); filePath = file.getAbsolutePath();//得到windows下的正确路径 System.out.println

    9.2K20编辑于 2022-11-10
  • 来自专栏实用技术

    Java多线程文件下载

    ){ logger.debug("下载地址:{},目标文件路径:{}",url,filePath); try { //创建下载文件 指定大小 RandomAccessFile raf = new RandomAccessFile(new File(filePath ){ logger.debug("源地址:{},目标地址:{}",url,filePath); try { (int threadIndex,String url,int timeout, String filePath) { this.url = url; this.filePath = url; this.filePath = filePath; this.threadIndex = threadIndex; this.timeout

    1K11编辑于 2022-02-09
  • 来自专栏我的博客

    Vue配置多模块

    var entryFiles = glob.sync(modulesPath + '/*/*.js') var map = {} // 遍历入口文件 entryFiles.forEach((filepath ) => { var filename = filepath.substring(filepath.lastIndexOf('/') + 1, filepath.lastIndexOf('.') map[filename] = filepath }) return map } // 多入口页面输出 exports.htmlPlugin = function () { var entryHtml = filepath.substring(filepath.lastIndexOf('/') + 1, filepath.lastIndexOf('.')) var conf = { template: filepath, filename: filename + '.html', inject: true,

    79610发布于 2019-12-10
  • 来自专栏王磊的博客

    文件写入的6种方法,这种方法性能最好

    FileWriter 类的实现如下: /** * 方法 1:使用 FileWriter 写文件 * @param filepath 文件目录 * @param content 待写入内容 * @throws IOException */ public static void fileWriterMethod(String filepath, String content) throws IOException { try (FileWriter fileWriter = new FileWriter(filepath)) { fileWriter.append = "/Users/mac/Downloads/io_test/write1.txt"; final String filepath2 = "/Users/mac/Downloads/ final String filepath4 = "/Users/mac/Downloads/io_test/write4.txt"; final String filepath5 =

    85020发布于 2020-12-23
  • harmony-utils之FileUtil,文件相关工具类

    = FileUtil.getFilesDirPath('download/wps/txt', 'demo.txt');let fileUri = FileUtil.getFileUri(filePath (strUri);getParentUri 通过URI或路径,获取对应文件父目录的URIlet filePath = FileUtil.getFilesDirPath('download/wps/txt ', 'demo.txt');if (FileUtil.accessSync(filePath)) { let parentUri = FileUtil.getParentUri(filePath); (filePath);} else { ToastUtil.showToast("文件不存在,请先创建和写入");}getUriFromPath 以同步方法获取文件URIlet filePath = let filePath = FileUtil.getFilesDirPath('download/wps/txt', 'demo.txt');if (FileUtil.accessSync(filePath

    27300编辑于 2025-06-28
领券