Skip to content

Commit

Permalink
0.20151118
Browse files Browse the repository at this point in the history
Init Version
  • Loading branch information
zvezdochiot committed May 25, 2018
0 parents commit c3179f1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Package: xcopy
Version: 0.20151118
Architecture: all
Maintainer: zvezdochiot <[email protected]>
Section: utils
Priority: optional
Installed-Size: 12
Depends: coreutils, findutils, cpio
Homepage: http://mykaralw.narod.ru/
Description: Bash-script for xcopy.
Bash-script for copy dir as sort structure.
1 change: 1 addition & 0 deletions config/md5sums
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
487cc27634e09ac08d44804196bf3989 usr/share/scripts/bash/xcopy.sh
1 change: 1 addition & 0 deletions data/usr/bin/xcopy
42 changes: 42 additions & 0 deletions data/usr/share/scripts/bash/xcopy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

#xcopy.sh
#2015-11-18

tdir=`pwd`;
srcdir="$1";
dstdir="$2";
flgcp="$3";

if [ "x$srcdir" = "x" -o "x$dstdir" = "x" ]
then
echo "Usage:"
echo "$0 srcdir destdir [nc|ln]"
exit 0
fi

if [ ! -d "$srcdir" ]
then
echo "Not find source $srcdir!"
exit 1
fi

if [ ! -d "$dstdir" ]
then
mkdir -pv "$dstdir"
fi

# tree dirs
find "$srcdir" -xtype d | sort | cpio -padv "$dstdir" ;

# copy file
if [ "x$flgcp" = "x" ]
then
find "$srcdir" -xtype f | sort | cpio -padv "$dstdir";
elif [ "x$flgcp" = "xln" ]
then
find "$srcdir" -xtype f -printf "%p\n" | sort | while read tfile
do
ln -fv "$tfile" "$dstdir/$tfile"
done
fi

0 comments on commit c3179f1

Please sign in to comment.