Correctly synchronize if a sub folder is selected (see #5979)