Reputation: 333
I want to copy a file to another location by cp C:/code.txt D:/code.txt ,any way to auto rename to code(2).txt or another name ,if code.txt was exist in D directory .Thanks much for any help !
cp C:/code.txt D:/code.txt
code(2).txt
code.txt
Upvotes: 2
Views: 5033
I found this answer cp --backup=numbered C:/code.txt D:/code.txt .
cp --backup=numbered C:/code.txt D:/code.txt
Upvotes: 5