← 返回命令列表

Linux command

find2perl 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Convert a find command to a Perl script

find2perl [directory] -name "[*.txt]"

Generate a script with -exec translation

find2perl [.] -type f -exec cat {} \;

Translate a complex find expression and save to a file

find2perl [/var] -mtime +[30] -name "[*.log]" > [cleanup.pl]

Run the generated Perl script directly

find2perl [.] -name "[*.bak]" | perl

说明

find2perl translates find command expressions into equivalent Perl scripts using the File::Find module. The generated Perl code typically runs faster than the original find command and can be modified to add custom processing beyond what find supports. The tool helps users migrate from shell-based find commands to Perl for complex file processing tasks. The output is a complete Perl script that can be piped directly to perl or saved and modified.

参数

-name _PATTERN_
Match filename against shell glob pattern.
-type _TYPE_
File type: f (regular file), d (directory), l (symbolic link).
-mtime _N_
Modification time in days (+N older, -N newer, N exactly).
-size _N_
File size.
-exec _CMD_
Execute command on matching files.
-print
Print matching paths (default action).
-depth
Process directory contents before the directory itself.

FAQ

What is the find2perl command used for?

find2perl translates find command expressions into equivalent Perl scripts using the File::Find module. The generated Perl code typically runs faster than the original find command and can be modified to add custom processing beyond what find supports. The tool helps users migrate from shell-based find commands to Perl for complex file processing tasks. The output is a complete Perl script that can be piped directly to perl or saved and modified.

How do I run a basic find2perl example?

Run `find2perl [directory] -name "[*.txt]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -name _PATTERN_ do in find2perl?

Match filename against shell glob pattern.