1
0
mirror of https://github.com/kmein/niveum synced 2026-03-18 19:11:08 +01:00
Files
niveum/packages/_todo/dirmir.sh

23 lines
484 B
Bash
Raw Normal View History

2019-08-25 15:39:59 +02:00
#!/bin/sh
SOURCE="$1"
TARGET="$2"
if [ ! -d "$SOURCE" ] || [ $# -ne 2 ]; then
echo >/dev/stderr "Usage: $1 SOURCE TARGET"
exit 1
fi
if [ -e "$TARGET" ]; then
echo >/dev/stderr "$TARGET" already exists. Please use a different name.
exit 1
fi
for entry in $(find "$SOURCE"); do
if [ -d "$entry" ]; then
mkdir -p "$TARGET/$entry"
else
# create a file with the same permissions as $entry
install -m "$(stat -c %a "$entry")" /dev/null "$TARGET/$entry"
fi
done