![](/style/images/good.png)
![](/style/images/bad.png)
Regarding linux cp same directory Similar files in another directory and rename?
source link: https://www.codesd.com/item/regarding-linux-cp-same-directory-similar-files-in-another-directory-and-rename.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Regarding linux cp same directory Similar files in another directory and rename?
I need copy some zip files(tea.zip, flower.zip, dog.zip) of "test" directory to "good" directory and rename them,I wish to use a command to complete the operation.
source: /home/test/,tea.zip, flower.zip, dog.zip
purpose: /home/good/,tea_ok.zip,flower_ok.zip, dog_ok.zip
1) How to write command at linux's ssh?
cp /home/test/[tea,flower,dog].zip /home/good/[tea,flower,dog]_ok.zip
Correct??
2) How to in bash?
Supplement:I need copy files,not move,and copy to different directory ,rename them.
It's intuitive to wirte this code.
mv /home/test/{tea,flower,dog}.zip /home/{tea,flower,dog}_ok.zip
But it's wrong unluckily.
I think a consecutive command in shell can't fulfil your requirement.
You'd better write a simple shell script.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK