Skip to content

Commit 6c8d8c8

Browse files
committed
0.20180525
Options Version
1 parent c3179f1 commit 6c8d8c8

File tree

7 files changed

+191
-16
lines changed

7 files changed

+191
-16
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2015 zvezdochiot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# XCopy
2+
3+
Bash-script for copy dir as sort structure.
4+
5+
https://github.com/zvezdochiot/bash-xcopy
6+
7+
## Make deb package
8+
9+
```
10+
du -s
11+
nano config/control #edit config
12+
sudo bash-deb-build lzma
13+
```
14+
15+
## Utilites
16+
17+
For build deb package install bash-deb-build:
18+
19+
https://github.com/zvezdochiot/bash-deb-build

config/control

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Package: xcopy
2-
Version: 0.20151118
2+
Version: 0.20180525-wheezy
33
Architecture: all
44
Maintainer: zvezdochiot <[email protected]>
55
Section: utils
66
Priority: optional
7-
Installed-Size: 12
7+
Installed-Size: 24
88
Depends: coreutils, findutils, cpio
9-
Homepage: http://mykaralw.narod.ru/
9+
Homepage: https://github.com/zvezdochiot/bash-xcopy
1010
Description: Bash-script for xcopy.
1111
Bash-script for copy dir as sort structure.

data/usr/share/doc/xcopy/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2015 zvezdochiot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

data/usr/share/doc/xcopy/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# XCopy
2+
3+
Bash-script for copy dir as sort structure.
4+
5+
https://github.com/zvezdochiot/bash-xcopy
6+
7+
## Make deb package
8+
9+
```
10+
du -s
11+
nano config/control #edit config
12+
sudo bash-deb-build lzma
13+
```
14+
15+
## Utilites
16+
17+
For build deb package install bash-deb-build:
18+
19+
https://github.com/zvezdochiot/bash-deb-build

data/usr/share/man/man1/xcopy.1

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.TH "XCopy User Manual" 0.20180525 "25 May 2018" "XCopy documentation"
2+
3+
.SH NAME
4+
xcopy
5+
6+
.SH DESCRIPTION
7+
Bash-script for copy dir as sort structure.
8+
9+
.SH SYNOPSIS
10+
xcopy [options] srcdir destdir
11+
12+
.SH OPTIONS
13+
.TP
14+
-l
15+
hardlink files
16+
.TP
17+
-n
18+
no copy files (only directory)
19+
.TP
20+
-h
21+
help
22+
23+
.SH EXAMPLE
24+
xcopy /path/to/my/files tmp
25+
26+
.SH COPYRIGHT
27+
Copyright 2015 zvezdochiot.
28+
All rights reserved.
29+
30+
.SH SEE ALSO
31+
cpio,
32+
find,
33+
sort,
34+
ln
35+
36+
.SH CONTACTS
37+
Website: https://github.com/zvezdochiot/bash-xcopy
38+

data/usr/share/scripts/bash/xcopy.sh

+70-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,72 @@
11
#!/bin/sh
22

33
#xcopy.sh
4-
#2015-11-18
4+
#2018-05-25
55

6+
echo "XCopy 0.20180525"
7+
8+
tnocomp=""
9+
tcomp="/bin/cpio"
10+
tdeb="cpio_*.deb"
11+
if [ ! -f "$tcomp" ]
12+
then
13+
tnocomp="$tnocomp $tcomp($tdeb)"
14+
fi
15+
tcomp="/usr/bin/find"
16+
tdeb="findutils_*.deb"
17+
if [ ! -f "$tcomp" ]
18+
then
19+
tnocomp="$tnocomp $tcomp($tdeb)"
20+
fi
21+
tcomp="/usr/bin/sort"
22+
tdeb="coreutils_*.deb"
23+
if [ ! -f "$tcomp" ]
24+
then
25+
tnocomp="$tnocomp $tcomp($tdeb)"
26+
fi
27+
tcomp="/bin/ln"
28+
tdeb="coreutils_*.deb"
29+
if [ ! -f "$tcomp" ]
30+
then
31+
tnocomp="$tnocomp $tcomp($tdeb)"
32+
fi
33+
if [ "x$tnocomp" != "x" ]
34+
then
35+
echo "Not found $tnocomp !"
36+
echo ""
37+
exit 1
38+
fi
39+
40+
fln="false"
41+
fnc="false"
42+
fhlp="false"
43+
while getopts ":lnh" opt
44+
do
45+
case $opt in
46+
l) fln="true"
47+
;;
48+
n) fnc="true"
49+
;;
50+
h) fhlp="true"
51+
;;
52+
*) echo "Unknown option -$OPTARG"
53+
exit 1
54+
;;
55+
esac
56+
done
57+
shift "$(($OPTIND - 1))"
658
tdir=`pwd`;
759
srcdir="$1";
860
dstdir="$2";
9-
flgcp="$3";
1061

11-
if [ "x$srcdir" = "x" -o "x$dstdir" = "x" ]
62+
if [ "x$srcdir" = "x" -o "x$dstdir" = "x" -o "x$fhlp" = "xtrue" ]
1263
then
1364
echo "Usage:"
14-
echo "$0 srcdir destdir [nc|ln]"
65+
echo "$0 [options] srcdir destdir"
66+
echo "Options:"
67+
echo " -l hardlink files"
68+
echo " -n no copy files (only directory)"
69+
echo " -h help"
1570
exit 0
1671
fi
1772

@@ -29,14 +84,16 @@ fi
2984
# tree dirs
3085
find "$srcdir" -xtype d | sort | cpio -padv "$dstdir" ;
3186

32-
# copy file
33-
if [ "x$flgcp" = "x" ]
34-
then
35-
find "$srcdir" -xtype f | sort | cpio -padv "$dstdir";
36-
elif [ "x$flgcp" = "xln" ]
87+
# copy/link file
88+
if [ "x$fnc" = "xfalse" ]
3789
then
38-
find "$srcdir" -xtype f -printf "%p\n" | sort | while read tfile
39-
do
40-
ln -fv "$tfile" "$dstdir/$tfile"
41-
done
90+
if [ "x$fln" = "xfalse" ]
91+
then
92+
find "$srcdir" -xtype f | sort | cpio -padv "$dstdir";
93+
else
94+
find "$srcdir" -xtype f -printf "%p\n" | sort | while read tfile
95+
do
96+
ln -fv "$tfile" "$dstdir/$tfile"
97+
done
98+
fi
4299
fi

0 commit comments

Comments
 (0)