Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file_crawler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file_crawler

  • 0.6.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

FileCrawler

Gem-version Build Status

Installation

Add this line to your application's Gemfile:

gem 'file_crawler'

And then execute:

$ bundle

Or install it yourself as:

$ gem install file_crawler

Usage

  • Create Instance
finder = FileCrawler::Finder.new
  • Find directories
path = '.'

finder.search(path)
p finder.directories #=> ["./bin", "./lib", "./spec", ...]
p finder.dirs #=> ["./bin", "./lib", "./spec", ...] # directories's shortname

finder.search(path, maxdepth: 1)
p finder.dirs #=> ["./bin", "./lib", "./spec"]

finder.search(path, maxdepth: 1, grep: 'sample')
p finder.dirs #=> []

  • Create groups per label decided by directory name
# collect use `directories`
# directories = ['/path/path1/[abcd] defg', '/path/path2/(abcd) defg', '/path/path1/test 123', ...
finder.collect(regexs: ['[]', '()'])
p finder.collections
#=> { 'abcd': ['/path/path1/[abcd] defg', '/path/path2/(abcd) defg'], 'test 123': ['/path/path1/test 123'], ... }
  • Move directory to destination
# move use `directories` or `collections`
# files = #=> ["./bin", "./lib", ...]
destination = '/var'
finder.move(destination)

# ensure destination
# [ [from, to], ... ]
p finder.targets #=> [["./bin", "/var/bin"] , ["./lib", "/var/lib"], ...]

# command output
p finder.output_mv #=> [ "mv ./bin /var/bin", "mv ./lib /var/lib", ...]

# run
finder.move(destination, dry_run: false)
  • Chain
finder.search(source, grep: 'sample').collect(regexs: ['[]']).move(destination)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hirohisa/file_crawler.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 29 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc