GithubHelp home page GithubHelp logo

seek's Introduction

seek

seek - Search current directory for files and folders

Installation

Source seek.sh in your .*rc file.

Usage

seek [OPTION] [PATTERN]

Options

  • -h, -? : Show help
  • -, -cd, -to : cd to the deepest directory containing all matches
  • +command: Pass all matches as arguments to command, replacing instances of {} with matching files.
    • Equivalent to "find -execdir command {} ;".
  • -* : Pass argument to find. Colons are interpreted as spaces (ie. -type:d = -type d)

Arguments are order independent, except for the special -- argument which causes the script to treat all following arguments as patterns.

A pattern consists of a number of parts separated by forward slashes, and are used to deterimine what will be matched by find.

foo/bar

The final (rightmost) part is matched against the name, while the entire pattern is matched against the path. If there are no slashes, the entire pattern is matched against the name.

Wildcards are implicitly added at the beginning and end of the pattern, as well as around each slash. The pattern above would translate to:

*foo*/*bar*

The - / -cd / -to option changes the current directory to the deepest directory that contains all matches, or returns 1 if this is equal to the current directory. This is done by finding the largest shared prefix of all matches that refers to a directory.

Examples

Search for files and folders in the current directory with names containing foo

seek foo

Search for directories with names containing foo

seek -type:d foo

Delete all files with names containing foo (See man find)

seek -delete foo

Search for files and folders with names containing bar in a directory containing foo

seek foo/bar

Change directory to the deepest directory containing all matches

seek foo/bar -

Pass all matches to cat

seek foo/bar +'cat {}'

Print all matches and their working directories

seek foo/bar +'echo {} $(pwd)'

License

seek - v1.2

Copyright (C) 2013 Mara Kim

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

seek's People

Contributors

astralarya avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.