Perl Scripts / 脚本
- 树状递归列出目录下面子目录和文件
#!/usr/bin/perl
#List all files and sub-directories as tree
#Under current directory, or directory specified in command line use strict;
use warnings;
use File::Spec::Functions qw(catdir splitdir); my $curdir = @ARGV ? $ARGV[0] : '.';
unless (-d $curdir) { die "$curdir is not directory." } tree($curdir, 0);
exit 0; sub tree {
my ($dir, $depth)=@_;
my @directories = grep{$_} splitdir($dir);
my $short_name = $directories[-1];
my $prefix = '| ' x $depth;
print "$prefix$short_name/\n";
opendir (my $dh, $dir);
my @entries = grep{ !/^\./ } readdir($dh);
foreach my $entry (@entries){
#my $path = catdir($dir, $entry); #List full path of file
my $path=$entry; #List files
if (-f $path ){ print "$prefix|--$path\n";}
elsif (-d _) {tree ($path, $depth+1);}
else { }
}
}
Perl Scripts / 脚本的更多相关文章
- npm scripts 脚本基础指南
什么是npm脚本? npm 允许在package.json文件里面,使用scripts字段定义脚本命令. 初始化package.json -> npm init -> 经历一系列的问答即可 ...
- 当然,perl等脚本服务器是一般默认安装了,你入侵了一台主机,总不能先装配 Java 环境然后再开干吧?
转自:https://www.zhihu.com/question/20173592 当然,perl等脚本服务器是一般默认安装了,你入侵了一台主机,总不能先装配 Java 环境然后再开干吧?
- Vue.js源码解析-从scripts脚本看vue构建
目录 1. scripts 脚本构建 1.1 dev 开发环境构建过程 1.1.1 配置文件代码 1.1.2 如何进行代码调试? 1.2 build 生产环境构建过程 1.2.1 scripts/bu ...
- [工具开发] Perl 爬虫脚本--从美国国家漏洞数据库抓取实时信息
一.简介 美国国家漏洞数据库收集了操作系统,应用软件的大量漏洞信息,当有新的漏洞出现时,它也会及时发布出来. 由于信息量巨大,用户每次都需要到它的网站进行搜索,比较麻烦.如果能有个工具,每天自动分析它 ...
- 一个基于时间注入的perl小脚本
use strict; use warnings; use LWP::Simple; my %table_and_leng; ;;$count++){ #print "Test Table: ...
- perl 脚本测试
原文地址: http://blog.csdn.net/johnny710vip/article/details/8905239 这是一篇关于perl脚本测试的总结性文章,其中提到了很多实用的 ...
- 这些年我们一起搞过的持续集成~Jenkins+Perl and Shell script
这些年我们一起搞过的持续集成~Jenkins+Perl and Shell script ##转载注明出处:http://www.cnblogs.com/wade-xu/p/4378224.html ...
- Installing vSphere SDK for Perl
Installing vSphere SDK for Perl 你可以安装vSphere SDK 在Linux 或者Microsoft Windows 系统,或者 部署 VSphere Managem ...
- orzdba_monitor.sh脚本使用
1.orzdba_monitor.sh脚本使用 ./orzdba_monitor.sh 主要是用nohup同时在后台调用orzdba,启动下面三个命令 [root@node02 scripts]# p ...
随机推荐
- 【codeforces 779D】String Game
[题目链接]:http://codeforces.com/contest/779/problem/D [题意] 给你一段操作序列; 按顺序依次删掉字符串1中相应位置的字符; 问你最多能按顺序删掉多少个 ...
- SystemServer概述
SystemServer由Zygote fork生成的,进程名为system_server,该进程承载着framework的核心服务. 调用流程如下: 上图前4步骤(即颜色为紫色的流程)运行在是Zyg ...
- selenium + firefox登录空间
在网上看到的大部分都是Python版本的,于是写了个java版本的 环境: selenium-java 3.9.1 firefox 57.0 geckodriver 0.19.1 firefox与ge ...
- ios 应用发布appStore
1.进入管理界面开发商 [点击 iTunes Connect] 2.进入管理apps界面 [点击 Manage Your Apps] watermark/2/text/aHR0cDovL2Jsb2cu ...
- 说下IEnumerable相关的
IEnumerable 我们每天都在使用foreach进行遍历,今天讨论下面三个常见的问题: 为什么在foreach中不能修改item的值 要实现foreach需要满足什么条件 为什么Linq to ...
- C#中的并发编程知识
= 导航 顶部 线程 Task async/await IAsyncResult Parallel 异步的回调 顶部 线程 Task async/await IAsyncResult Pa ...
- UVa 12657 Boxes in a Line(应用双链表)
Boxes in a Line You have n boxes in a line on the table numbered 1 . . . n from left to right. Your ...
- Java--垃圾收集算法及内存分配策略
本篇博客,主要介绍GC的收集算法以及根据算法要求所得的内存分配策略! 一.收集算法 收集算法,主要包括四种,分别是:Mark-Sweep(标记-清除).Copying(复制).Mark-Compact ...
- 在嵌入式程序中QT去掉鼠标指针
在像arm的QT编程当中,一般都是使用触摸来操作,当是我们运行程序的时候会发现总是有个鼠标箭头在那里,下面介绍种方法将其给去掉.这样就漂亮多了.在main()函数加入 #include <QWS ...
- keras 的使用
theano 以及 TensorFlow 是 keras 的 backend(后端支持),因此,keras 本质上是对 thenao 或者 TensorFlow 的进一步封装(wrapper). ke ...