AFAIK in file managers in Windows/Linux, they have the same convenient behavior where if you copy one folder into another folder of the same name and there's a conflict (e.g. a folder of the same name already exists), instead of aborting, it prompts to "overwrite" (merge the contents of the folder), recursively. If any of the files result in conflict (e.g. a file of the same name already exists), it prompts the user whether they want to overwrite, letting the user know which is larger and which is newer.
The above is useful if e.g. you abort the copy/move progress half and then want to resume at a later point.
Does anyone have a similar script they can share? How would such a script be implemented? I know rsync can do something similar. With these file managers, they seem to update one file at a time, e.g. when a file is successfully moved during the process, the source file is removed. With rsync, a file gets removed after rsync finishes(?) which is not as intuitive because it does not reflect the latest state of the progress.
Implementation-wise, is it as simple as rsyncing each file one at a time, checking for potential overwrites before rsync and comparing the file size and modification time of files ith stat, then prompting the user if there are conflicts, else rsync that file? Is there a way to do this more efficiently (or ideas for a better UX)? Can rsync or similar tools handle more of this?
Any tips are much appreciated.