find.pl is a lightweight, flexible, and powerful command-line utility written in Perl that replicates and extends the behavior of Unix's native find command. With support for symbolic link traversal, depth-limited search, advanced expression parsing, and file metadata inspection, it's ideal for power users, sysadmins, and developers needing fine-grained control over file discovery tasks.
find.pl is a feature-rich file search tool for Unix-like systems built using Perl. It walks a directory hierarchy, evaluating logical expressions to locate files and directories based on their name, permissions, type, size, and other attributes. It supports a wide range of tests, actions, and logical operators, offering a familiar and powerful alternative to the native find(1) command.
- π Expression-based matching: Combine filters like
-name,-mtime,-size, and-perm. - βοΈ Symbolic link traversal: Use
-Lto follow symlinks. - π Depth control: Limit search with
-maxdepth. - β‘ Exec actions: Run custom commands on matched files using
-exec. - π§ͺ Advanced tests:
- File age:
-atime,-mtime,-ctime - Permissions:
-perm - Ownership:
-nouser,-nogroup - Type:
-type(e.g. files, directories, symlinks)
- File age:
- π Actions:
- Print to stdout:
-print,-print0 - Skip directories:
-prune - File stats output: custom
stat_plhelper
- Print to stdout:
perl find.pl [-L] [starting-point] [expression]Find all .log files modified in the last 2 days:
perl find.pl /var/log -name "*.log" -mtime -2 -printFind files over 10 MB and display their details:
perl find.pl /data -size +10M -exec stat_pl {} \;List all empty directories:
perl find.pl . -type d -empty -printSearch case-insensitively for .jpg files under Pictures:
perl find.pl ~/Pictures -iname "*.jpg" -printAvoid descending into .git directories:
perl find.pl . -path "*.git*" -prune -o -print- Perl version 5.10 or later
- Compatible with Unix-like environments (Linux, macOS, BSD)
- No external dependencies (pure Perl)
Contributions are welcome!
- Fork this repository
- Create a new branch:
git checkout -b feature/your-feature - Make your changes and test thoroughly
- Commit and push:
git commit -m "Add your feature"thengit push origin feature/your-feature - Open a pull request
If you'd like to suggest improvements or report bugs, feel free to open an issue.
This project is licensed under the Apache License 2.0.