a4fb
![]() |
|
|
|
|
|||||||
| Userland Programming & Scripting C, Shell, Perl, Sed & Awk |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Under my NanoBSD system, I need to copy all files and directories (that are differents from a reference). And because the destinations directories don't exist, I'm using cpio. Here is an extract of my shell script: Code:
(
cd /etc
for i in "$@" `find * -type f`
do
if [ -f /cfg/$i ]
then
cmp -s /etc/$i /cfg/$i || cp -pfv /etc/$i /cfg/$i 2>/dev/null
else
cmp -s /conf/base/etc/$i /etc/$i || (find $i -print | cpio -dumpv /cfg/ 2>/dev/null)
fi
done
)
The problem is that cpio don't preserve directory permission: Code:
[root@router]~#ls -alh /conf/base/etc | grep local drwxr-xr-x 6 root wheel 512B Aug 25 21:08 local [root@router]~#ls -alh /cfg | grep local drwx------ 3 root wheel 512B Aug 26 15:39 local I've tried to add "-depth" option to find (as reported here), but no changes. Anyone have an idea ? Thanks Last edited by olivier; August 26th, 2009 at 21:26. Reason: solved |
|
#2
|
||||
|
||||
|
Look at -o and -i option.
Quote:
__________________
Neither in this world nor elsewhere is there any happiness in store for him who always doubts. If you enjoyed my answer please consider donating some money to FreeBSD foundation @ http://www.freebsdfoundation.org/ |
|
#3
|
|||
|
|||
|
I've the problem by replacing this line:
Code:
for i in "$@" `find * -type f` Code:
for i in "$@" `find * -depth` |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mounting a filesystem with different permissions? | wonslung | General | 2 | June 19th, 2009 11:55 |
| question about nullfs and permissions | wonslung | General | 3 | June 16th, 2009 08:00 |
| NFS mounting and permissions | Trojan | Web & Network Services | 9 | May 25th, 2009 07:39 |
| DNS and Permissions | Enter4 | Web & Network Services | 1 | February 6th, 2009 22:19 |
| FTP ports help on permissions | rowinms | Web & Network Services | 1 | January 13th, 2009 08:37 |