handle case when file and dest have same basenames
This commit is contained in:
parent
9ca7b1c590
commit
36435d6773
@ -155,15 +155,17 @@ copy_file()
|
|||||||
|
|
||||||
# iterate throught symlinks and copy them
|
# iterate throught symlinks and copy them
|
||||||
while [ -h "$file" ]; do
|
while [ -h "$file" ]; do
|
||||||
cp -P "$file" "${tmpdir}${dest}" || panic
|
cp -P "$file" "${tmpdir}${dest%/*}/${file##*/}"
|
||||||
cd -P "${file%/*}"
|
cd -P "${file%/*}"
|
||||||
|
|
||||||
symlink=$(ls -ld "$file")
|
symlink=$(ls -ld "$file")
|
||||||
symlink="${symlink##* -> }"
|
symlink="${symlink##* -> }"
|
||||||
|
|
||||||
file="${PWD}/${symlink##*/}"
|
file="${PWD}/${symlink##*/}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# handle case when file and dest have same basenames
|
||||||
|
[ -h "${tmpdir}${dest}" ] && dest="${dest%/*}/${file##*/}"
|
||||||
|
|
||||||
{
|
{
|
||||||
cp "$file" "${tmpdir}${dest}"
|
cp "$file" "${tmpdir}${dest}"
|
||||||
chmod "$mode" "${tmpdir}${dest}"
|
chmod "$mode" "${tmpdir}${dest}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user