I have a folder in my server which contains some files. These are automated that means everyday we get new files automatically which will overwrite the old ones. So want to take
cp --archive home/webapps/project1/folder1/{aaa,bbb,ccc,ffffd}.csv home/webapps/project1/folder2
rename 's/\.csv$/'$(date +%m%d%Y).csv'/' home/webapps/project1/folder2/{aaa,bbb,ccc,ffffd}.csv
Explanation:
--archive
ensures that the files are copied with the same ownership and permissions.foo{bar,baz}
is expanded into foobar foobaz
.rename
is a commonly available program to do exactly this kind of substitution.PS: don't use ls for this.