Code Monkey home page Code Monkey logo

smart-file-copy's Introduction

The Smart Copy

smart_copy.sh copies files that satisfy the size and extension requirements from the source to the target directory.

Synopsis

smart_copy.sh [OPTIONS] SOURCE TARGET

Description

Positional arguments must be written after all short options, or else they will not be interpreted correctly.

tests.sh contains the script's tests. Run in order to check if everything works properly, or read the code to see some examples of script use.

source directory contains meaningless files that are used only for tests of tests.sh.

Option list

  • -s "PATTERN": Specifies size pattern for find command -size option. For example, "./smart_copy.sh -s "-100c" source copy" will only match files that have a size lesser than 100 bytes.

  • -i "EXTENSIONS": List of file extension names in the form "ext1 ext2 ext3" (for example: "txt zip py json yaml"), which will be ignored and not copied.

  • -o "EXTENSIONS": List of extension names, only files with which will be copied. If Specified, -i option will have no effect.

  • -a: Includes hidden files and directories into search. Without it, they will be ignored.

  • -p: Prints generated regex patterns for file paths. The first one must match, and the second one must not, or else the file path will be omitted.

  • -l: Prints a list of files that will be copied.

  • -v: Prints a list of script parameters and their values.

  • -d: Disables files copying. Only useful for debugging.

  • -h/--help: Prints README.md content and then exits without further actions.

Requirements

This script is written for GNU bash version 5.1.16(1)-release (x86_64-pc-linux-gnu) installed on Ubuntu 22.04.4 LTS. It may or may not work properly on other Bash versions or operating systems.

smart-file-copy's People

Contributors

imandyr 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.