[OpenIndiana-discuss] ZFS; what the manuals don't say ...

Gregory S. Youngblood gregory at youngblood.me
Tue Oct 23 15:27:31 UTC 2012


Probably should use find -type f to limit to files and also cp -a to maintain permissions and ownership. Not sure if the will maintain ACLs.

For the truly paranoid, dont delete the original file so early, rename it, move the temp file back as the original filename, then compare md5 or sha checksums to make sure they are the same, only deleting the original file if the two sums match.

--
Sent from my Jelly Bean Galaxy Nexus

Roy Sigurd Karlsbakk <roy at karlsbakk.net> wrote:

>> Wouldn't walking the filesystem, making a copy, deleting the original
>> and renaming the copy balance things?
>> 
>> e.g.
>> 
>> #!/bin/sh
>> 
>> LIST=`find /foo -type d`
>> 
>> for I in ${LIST}
>> do
>> 
>> cp ${I} ${I}.tmp
>> rm ${I}
>> mv ${I}.tmp ${I}
>> 
>> done
>
>or perhaps
>
># === rewrite.sh ===
>#!/bin/bash
>
>$fn=$1
>$newfn=$fn.tmp
>
>cp $fn $newfn
>rm -f $fn
>mv $newfn $fn
># === rewrite.sh ===
>
>find /foo -type f -exec /path/to/rewrite.h {} \;
>
>Vennlige hilsener / Best regards
>
>roy
>--
>Roy Sigurd Karlsbakk
>(+47) 98013356
>roy at karlsbakk.net
>http://blogg.karlsbakk.net/
>GPG Public key: http://karlsbakk.net/roysigurdkarlsbakk.pubkey.txt
>--
>I all pedagogikk er det essensielt at pensum presenteres intelligibelt. Det er et elementært imperativ for alle pedagoger å unngå eksessiv anvendelse av idiomer med xenotyp etymologi. I de fleste tilfeller eksisterer adekvate og relevante synonymer på norsk.
>
>_______________________________________________
>OpenIndiana-discuss mailing list
>OpenIndiana-discuss at openindiana.org
>http://openindiana.org/mailman/listinfo/openindiana-discuss


More information about the OpenIndiana-discuss mailing list