Skip to content
forked from mitool/find2

用golang写的查找/替换文件内容的工具

License

Notifications You must be signed in to change notification settings

xiyang2011/find2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find2

用golang写的查找/替换文件内容的工具。

特性

  1. 支持按内容搜索文件
  2. 支持替换文件内容
  3. 支持将匹配到的文件保存到指定文件夹
  4. 支持将匹配到的文件进行zip压缩(保存为compress.zip)
  5. 匹配规则统一使用正则表达式

用法

执行以下命令

go build

# 查看用法
find2 -h

example:

./find2 -findPath ./www -fileRule \.php$ -contentRule "a\.user|a\.profile" -savePath ./found -compress true

本例中,压缩后的文件保存在"./found/compress.zip"。

用参数组合实现特定功能

  1. 如果不设置-contentRule,并且设置-compresstrue,则会将符合规则的文件添加到zip压缩包。
  2. 如果不设置-contentRule,并且设置-compressfalse或者不设置,则会将符合规则的文件复制到-savePath指定的目录中, 如果不指定-savePath的值则复制到当前目录中。
  3. 如果设置了-contentRule但没有设置-savePath时,则会直接修改原文件并将原始文件保存一份备份。 可以用./find2 -restore 20161006093020还原指定时间的备份。

About

用golang写的查找/替换文件内容的工具

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 95.8%
  • Batchfile 4.2%