speedup to file_list code in /sbin/lunar

Ranitha Mapatuna ranitha at optusnet.com.au
Sun Oct 10 06:40:25 UTC 2004


Hey Again,
	Ignore the previous version. This is equally fast but much cleaner (no
temp files). Hardcrash's idea my debugging this time 'round :P

Regards,
	Ranitha

file_list() {
        pushd $1 > /dev/null
        file -N -F ' ' * | cut -d ' ' -f1,3 --output-delimiter='
        '
        popd > /dev/null
}




On Sun, 2004-10-10 at 15:49 +1000, Ranitha Mapatuna wrote:
> Hey,
> 	The following code for the file_list function in /sbin/lunar produces a
> significant speed improvement over the current code. It tested fine at
> my end and with hardkrash as well. Credit goes to hardkrash for help
> with debugging and implementation.
> 
> Regards,
> 	Ranitha
> 
> file_list() {
>   flList=`find $1/ -type f -fprintf /tmp/lunar-$$-fl "%f\n" -print`
>   file -b $flList | cut -d ' ' -f 1 > /tmp/lunar-$$-ft
>   paste -d '\n' /tmp/lunar-$$-fl /tmp/lunar-$$-ft
>   rm -f /tmp/lunar-$$-fl /tmp/lunar-$$-ft
> }
> 
> _______________________________________________
> Lunar mailing list
> Lunar at lunar-linux.org
> http://lunar-linux.org/mailman/listinfo/lunar



More information about the Lunar mailing list