How could I copy every regular files (not directories or any other type) from ~/foo
that ends in a digit greater or equal than 3 to ~/bar
? I tried with the find
and cp
commands, but I couldn't get it to work: find ~/foo -type f -regex '.*[!012]' -exec cp ~/bar
.
Examples:
some.file12
wouldn't be copied because its last digit is 2, and 2 < 3.somefile603
would be copied. 3 = 3.foo3405
would be copied. 4 > 3.file02.txt
wouldn't be copied. It doesn't end in a digit.