ulink,mkpath,rmtree
来源:互联网 发布:网络神话魔法圣皇 编辑:程序博客网 时间:2024/06/06 11:47
perl中的unlink: * unlink Deletes a list of files. On success, it returns the number of files it successfully deleted. On failure, it returns false and sets $! (errno): 1. my $unlinked = unlink 'a', 'b', 'c'; 2. unlink @goners; 3. unlink glob "*.bak"; On error, unlink will not tell you which files it could not remove. If you want to know which files you could not remove, try them one at a time: 1. foreach my $file ( @goners ) { 2. unlink $file or warn "Could not unlink $file: $!"; 3. } Note: unlink will not attempt to delete directories unless you are superuser and the -U flag is supplied to Perl. Even if these conditions are met, be warned that unlinking a directory can inflict damage on your filesystem. Finally, using unlink on directories is not supported on many operating systems. Use rmdir instead. If LIST is omitted, unlink uses $_ .2:mkpath and rmtree:File::Path有2个方法:mkpath和rmtree,分别为创建目录和删除目录。perl语言本身自带了 mkdir和rmdir,那为什么还要选用mkpath和rmtree呢?自带的mkdir只能一次创建一级目录,而mkpath则可以一次创建多级;rmdir必须要求目录为空,而rmtree则任意。总之,File::Path为我们提供了另一种创建和删除目录的机制,由用户自己选用。说明:a) mkpath(directory, 1, 0711);第一个参数为目录名,第二个参数为一个bool值,为真的时候打印每次创建的目录,默认为假,最后一个参数为目录的权限。b) rmtree(directory, 1, 1);第一个参数为目录名,第二个参数为一个bool值,为真的时候打印删除文件时的一些信息,默认为假,最后一个参数也是一个bool值,为真的时候对没有删除权限的文件直接跳过。http://perldoc.perl.org/File/Path.html
- ulink,mkpath,rmtree
- shutil.rmtree()
- shutil.rmtree
- shutil.rmtree()
- Jtag、Jlink与Ulink
- ulink 、 jlink 、 openjtag 区别
- jtag.ulink,jlink 区别
- perl-modules: File::Path::rmtree makes setuid
- JLINK、ULINK及ST-LINK
- No ulink device found肿么办
- JTAG、JLINK、ULINK、ST-LINK的区别
- JLINK、JTAG、ULINK、STLINK的区别
- JTAG,Jlink,ulink,h-Jtag,RDI,SWD
- JTAG、JLink、ULINK、ST-LINK仿真器区别
- JTAG JLink ULINK ST-LINK仿真器区别
- JTAG和ULINK、JLINK、ST-LINK
- ULINK的手动刷新固件
- 使用ULINK调试LM3S815的flash timeout问题
- INFORMIX字符集相关知识
- 敏捷教练的工具箱 详细下载地址
- 八方向迷宫 C++版
- 二、Action对象
- List、vector、set、map的区别与联系
- ulink,mkpath,rmtree
- ASP.NET(C#)中web.config文件详解
- 完善flex调用jsp打开和下载文件的例子
- NSLog 输出格式!
- C++中的位域详解
- [ZZ]推荐19个很有用的 JavaScript 库
- 事务的传播行为
- 三、Struts2的配置文件
- 服务端检测你的浏览器(HttpBrowserCapabilities)