Skip to content

Commit c3179f1

Browse files
committed
0.20151118
Init Version
0 parents  commit c3179f1

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

config/control

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Package: xcopy
2+
Version: 0.20151118
3+
Architecture: all
4+
Maintainer: zvezdochiot <[email protected]>
5+
Section: utils
6+
Priority: optional
7+
Installed-Size: 12
8+
Depends: coreutils, findutils, cpio
9+
Homepage: http://mykaralw.narod.ru/
10+
Description: Bash-script for xcopy.
11+
Bash-script for copy dir as sort structure.

config/md5sums

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
487cc27634e09ac08d44804196bf3989 usr/share/scripts/bash/xcopy.sh

data/usr/bin/xcopy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../share/scripts/bash/xcopy.sh

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
#xcopy.sh
4+
#2015-11-18
5+
6+
tdir=`pwd`;
7+
srcdir="$1";
8+
dstdir="$2";
9+
flgcp="$3";
10+
11+
if [ "x$srcdir" = "x" -o "x$dstdir" = "x" ]
12+
then
13+
echo "Usage:"
14+
echo "$0 srcdir destdir [nc|ln]"
15+
exit 0
16+
fi
17+
18+
if [ ! -d "$srcdir" ]
19+
then
20+
echo "Not find source $srcdir!"
21+
exit 1
22+
fi
23+
24+
if [ ! -d "$dstdir" ]
25+
then
26+
mkdir -pv "$dstdir"
27+
fi
28+
29+
# tree dirs
30+
find "$srcdir" -xtype d | sort | cpio -padv "$dstdir" ;
31+
32+
# copy file
33+
if [ "x$flgcp" = "x" ]
34+
then
35+
find "$srcdir" -xtype f | sort | cpio -padv "$dstdir";
36+
elif [ "x$flgcp" = "xln" ]
37+
then
38+
find "$srcdir" -xtype f -printf "%p\n" | sort | while read tfile
39+
do
40+
ln -fv "$tfile" "$dstdir/$tfile"
41+
done
42+
fi

0 commit comments

Comments
 (0)