I have this situation where there's a lot of files with similar names (but they all follow a pattern) in different subfolders
file1 file1 (Copy) /folder1/file2.txt /folder1/file2 (Copy).txt /folder1/file3.png /folder1/file3 (Copy).png
Each file is in the same folder of its copy and has the same extension, the difference is that it has
(Copy) at the end of the name
I want to get all these files and delete the oldest one, then eventually rename the file from, for example,
file1 (Copy) to
file1 (that is, remove the
(Copy) suffix) if it needs to be renamed.
I was thinking of using
mv but I'm not sure how to tell it to move the most recent one.