[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Rechte übertragen



Hallo Andre,

Am Fri, 25 Apr 2014, Andre Tann schrieb:
>In Prinzip ginge das so:
>
>	find /quelle -printf 'chown %U:%G "%p"\n'
>
>Dahinter vielleicht noch ein wenig sed-Magie, und fertig wäre das
>Skript, welches man auf den Zielbaum jagen kann.

# l -b kranke_namen
total 0
-rw-r--r-- 1 root dh 0 May  7 20:43 foo\ *"\ '\n\ bar*
-rw-r--r-- 1  501 dh 0 May  7 20:43 foo\ *"\ '\ bar*
-rw-r--r-- 1  399 dh 0 May  7 20:42 foo"\ '\ bar
# l -b kranke_namen2 
total 0
-rw-r--r-- 1 dh dh 0 May  7 20:43 foo\ *"\ '\n\ bar*
-rw-r--r-- 1 dh dh 0 May  7 20:43 foo\ *"\ '\ bar*
-rw-r--r-- 1 dh dh 0 May  7 20:42 foo"\ '\ bar
# cd kranke_namen2

# find ../kranke_namen/ -mindepth 1 -printf '%U:%G\0%P\0' | \
    xargs -r0 -n 2 chown -c
changed ownership of `foo *" \'\n bar*' from dh:dh to 0:1024
changed ownership of `foo *" \' bar*' from dh:dh to 501:1024
changed ownership of `foo" \' bar' from dh:dh to 399:1024

Das '-mindepth 1' verhindert ein

chown: cannot access `': No such file or directory

auf dem aktuellen Verzeichnis selber, dessen Rechte müßte man ggfs. 
noch per Hand vorher oder nachher korrigieren.

HTH,
-dnh

-- 
"Fix the problem, not the blame."   -- Peter H. Coffin


Reply to: