Gate some writes on folder chanages

This only writes the folder change when it's necessary, which is a
nice optimization.  It doesn't matter nearly so much now that I have
an SSD, but I guess everything helps a little bit :).