• Stars
    star
    386
  • Rank 110,562 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

copy files on the command line

copyfiles Build Status

copy files easily

Install

npm install copyfiles -g

Command Line

  Usage: copyfiles [options] inFile [more files ...] outDirectory

  Options:
    -u, --up       slice a path off the bottom of the paths               [number]
    -a, --all      include files & directories begining with a dot (.)   [boolean]
    -f, --flat     flatten the output                                    [boolean]
    -e, --exclude  pattern or glob to exclude (may be passed multiple times)
    -E, --error    throw error if nothing is copied                      [boolean]
    -V, --verbose  print more information to console                     [boolean]
    -s, --soft     do not overwrite destination files if they exist      [boolean]
    -F, --follow   follow symbolink links                                [boolean]
    -v, --version  Show version number                                   [boolean]
    -h, --help     Show help                                             [boolean]

copy some files, give it a bunch of arguments, (which can include globs), the last one is the out directory (which it will create if necessary). Note: on windows globs must be double quoted, everybody else can quote however they please.

copyfiles foo foobar foo/bar/*.js out

you now have a directory called out, with the files foo and foobar in it, it also has a directory named foo with a directory named bar in it that has all the files from foo/bar that match the glob.

If all the files are in a folder that you don't want in the path out path, ex:

copyfiles something/*.js out

which would put all the js files in out/something, you can use the --up (or -u) option

copyfiles -u 1 something/*.js out

which would put all the js files in out

you can also just do -f which will flatten all the output into one directory, so with files ./foo/a.txt and ./foo/bar/b.txt

copyfiles -f ./foo/*.txt ./foo/bar/*.txt out

will put a.txt and b.txt into out

if your terminal doesn't support globstars then you can quote them

copyfiles -f ./foo/**/*.txt out

does not work by default on a mac

but

copyfiles -f "./foo/**/*.txt" out

does.

You could quote globstars as a part of input:

copyfiles some.json "./some_folder/*.json" ./dist/ && echo 'JSON files copied.'

You can use the -e option to exclude some files from the pattern, so to exclude all files ending in .test.js you could do

copyfiles -e "**/*.test.js" -f ./foo/**/*.js out

Other options include

  • -a or --all which includes files that start with a dot.
  • -s or --soft to soft copy, which will not overwrite existing files.
  • -F or --follow which follows symbolinks

copyup

also creates a copyup command which is identical to copyfiles but -up defaults to 1

Programic API

var copyfiles = require('copyfiles');

copyfiles([paths], opt, callback);

takes an array of paths, last one is the destination path, also takes an optional argument which the -u option if a number, otherwise if it's true it's the flat option or if it is an object it is a hash of the various options (the long version e.g. up, all, flat, exclude, error, verbose, follow, and soft)

Tilde support for home directory

when the src/dest path start with tilde for home directory under windows, please make sure -u or -f is added in options or use copyup command. if not you will get Error: Illegal characters in path.

More Repositories

1

lie

A basic but performant promise implementation.
JavaScript
741
star
2

shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
JavaScript
651
star
3

catiline

JavaScript library to take the pain out of web workers.
JavaScript
579
star
4

leaflet-ajax

plugin for leaflet for ajax
JavaScript
353
star
5

crypto-pouch

plugin for encrypted pouchdb/couchdb databases
JavaScript
242
star
6

leaflet.shapefile

Shapefile in Leaflet
JavaScript
242
star
7

tap-nyan

tap -> nyan
JavaScript
146
star
8

immediate

cross browser microtask
JavaScript
146
star
9

rollup-plugin-node-builtins

JavaScript
137
star
10

topojson.py

Topojson ported to python
Python
92
star
11

rollup-plugin-node-globals

JavaScript
90
star
12

SQLdown

sql backend for levelup
JavaScript
72
star
13

fileGDB.js

parse a file GDB
JavaScript
67
star
14

derequire

remove require statements without breaking scope
JavaScript
65
star
15

leaflet.filegdb

use an ESRI file geodatabase in leaflet
JavaScript
49
star
16

leaflet.pouch

PouchDB layer for leaflet
JavaScript
38
star
17

chacha20poly1305

chacha20/poly1305 with the node api
JavaScript
38
star
18

esri2geo

Converts ESRI json to geojson
JavaScript
38
star
19

leaflet.d3

leaflet + d3
JavaScript
34
star
20

leaflet.demos

Some demos for leaflet
JavaScript
32
star
21

native-crypto

crypto that should work in both the browser and in node using native modules where available
JavaScript
31
star
22

process-nextick-args

process.nextTick always accepts args, always
JavaScript
31
star
23

pouch-dat

replicate from pouch to dat
JavaScript
23
star
24

PouchStream

use some streams with your pouches
JavaScript
20
star
25

node-lfu-cache

JavaScript
19
star
26

leaflet.workspace

a quick and dirty workspace for you.
JavaScript
19
star
27

level-tree

R-tree spatial index for GeoJSON in LevelDB
JavaScript
18
star
28

minimalistic-assert

JavaScript
18
star
29

mbliberator

liberate your mbtiles from the tyranny of sqlite
JavaScript
17
star
30

simplify-rs

Rust
15
star
31

set.up

functional tools for es6 sets
JavaScript
13
star
32

esri2topo

Python
12
star
33

buffer-shims

JavaScript
12
star
34

medium

Like Big but less so
JavaScript
11
star
35

CodeForBoston-Census

Repo for the census group.
JavaScript
11
star
36

noms

easily make noms for your other streams to consume
JavaScript
10
star
37

ltcdr

like commander, but accepting pull requests
JavaScript
10
star
38

deckpad

presentations made easier
JavaScript
10
star
39

MassGIS

MassGIS -> Open
10
star
40

async-iter-stream

streams as asyncIterators
JavaScript
9
star
41

leaf-couch

leaflet in the front, couchdb in the back
JavaScript
9
star
42

macrotask

A cross browser macrotask library
JavaScript
9
star
43

es6-stream

streams, but with generators
JavaScript
9
star
44

parseDBF

JavaScript
9
star
45

streams-a-love-story

Node Interactive talk entitled Streams and You: A Love Story
HTML
8
star
46

rollup-config-cjs

JavaScript
8
star
47

esri2gist

Make Gists inside Arcmap
Python
8
star
48

buffer-es6

es6 port of browserify buffer
JavaScript
7
star
49

async-rtree

An async rtree
JavaScript
6
star
50

web-worker

make web workers from strings in many browsers
JavaScript
6
star
51

cabs

Content Addressable Blob Store
JavaScript
6
star
52

proj4geojson

JavaScript
6
star
53

chacha-native

node bindings for chacha20 in c
C++
6
star
54

liar

A modular collection of tools for asynchronous programing via promises
JavaScript
6
star
55

coshp

Cloud Optimized Shapefiles
JavaScript
5
star
56

jsgeo

Calvin's js.geo presentation
JavaScript
5
star
57

rollup-plugin-auto-transform

JavaScript
5
star
58

cw.ajax

ajax plugin
JavaScript
5
star
59

name-me

come up with a name for your npm package
JavaScript
5
star
60

salsa20

JavaScript
5
star
61

inline-process-browser

inline references to 'process.browser' to 'true'
JavaScript
5
star
62

es6-translate

Yo dawg I heard you liked modules, so I made a module to translate your modules into modules.
JavaScript
5
star
63

spider-stream

recursively get files in a directory and sub directories, as a stream
JavaScript
4
star
64

nontree

geohashes, but turned up to 102 in ternary
JavaScript
4
star
65

vector-layers

vector layers in leaflet
JavaScript
4
star
66

flaming-wight

pouch demo from my blog
JavaScript
4
star
67

node-process-es6

JavaScript
4
star
68

SBS

Sync Buffer Stream: A stream that synchronously buffers and then drains on the next tick
JavaScript
4
star
69

geojson-assert

assert stuff about geojson (well just one thing)
JavaScript
4
star
70

shp-write-stream

stream write shapefiles, sorta
JavaScript
4
star
71

leaflet.css

moved
JavaScript
3
star
72

io-stream

iojs-core streams for userland
JavaScript
3
star
73

cloud-pubsub

JavaScript
3
star
74

crypto-stream

streaming authenticated encryption stream
JavaScript
3
star
75

pem2jwk

JavaScript
3
star
76

leaflet.sprite

moved
CoffeeScript
3
star
77

sublevel-migrate

migrate v5 sublevels to v6
JavaScript
3
star
78

create-cipher

the node ciphers you always wanted
JavaScript
3
star
79

kublai

express + tilelive + cats
JavaScript
3
star
80

projections-in-web-browsers-are-terrible-and-you-should-be-ashamed-of-yourself

I have opinions
JavaScript
3
star
81

kubernetes-scripts

JavaScript
2
star
82

csr

JavaScript
2
star
83

lie-parallel

JavaScript
2
star
84

express-simple-auth-token

JSON web token middleware for express designed to work with Ember Simple Auth Token
JavaScript
2
star
85

pouchdb-topromise

JavaScript
2
star
86

leaflet-workshop

workshop at avidgeo
JavaScript
2
star
87

maptime-git

JavaScript
2
star
88

k3

JavaScript
2
star
89

deckdemo

JavaScript
2
star
90

parcel-map

JavaScript
2
star
91

FieldMapping

tools for dealing with arcpy field mapping
Python
2
star
92

intercal

TODO port to JS
C
2
star
93

service-account

sugar for easier access to google service account keys
JavaScript
2
star
94

cartodb-console

JavaScript
2
star
95

cw.mapReduce

JavaScript
2
star
96

hmac-stream

streaming HMACs
JavaScript
2
star
97

ppp

2
star
98

offline-talk

HTML
1
star
99

pouchdb-promise

JavaScript
1
star
100

cwm

JavaScript
1
star