I have files with random numbers in /home/user/files folder (every 4 days I have new ones). for example:
john20
john25
john40
tom12
tom32
simon2
simon8
simon53
I want to take only last modified files (the newest) and copy them to different location (/home/user/fixed) without that numbers in file name.
I know how to filter and copy that using find command but I don't know how copy all of them without that numbers.
find $files_are_here -maxdepth 1 -mtime -2 -type f -exec cp {} $new_path \;
This will copy all of the files modified in the last 2 days to the new path but with original name. In my case:
john40
tom32
simon53
but I would like to have only john, tom and simon inside that folder. So after I run my script again they will be replaced by the newest one.