-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init Version
- Loading branch information
0 parents
commit c3179f1
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
487cc27634e09ac08d44804196bf3989 usr/share/scripts/bash/xcopy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../share/scripts/bash/xcopy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |