Removing all internal self.samples should work, as the DatasetFolder class uses this attribute to get the length as seen here 1.
Alternatively, you could also try to monkey-patch the __len__(self) method and assign the desired value to it, assuming you want to reduce the number of samples and remove the last samples.
With that being said, I don’t know what your use case is and would generally recommend to create either a new Dataset with the desired attributes or create a custom one.