in reply to Retaining the most recent file in a FS

WIN32_SLOPPY_STAT is an optimization which does not come into play in your case.

Use File::Find to recursively find files.

Use File::Copy to copy files and File::Path to create directories.

Where do you have problems exactly? What code have you written already?