remove files in bash

I have files image1, …, image5.

I want to rename them as image_test_2,…., image_test_6

 for i in $(seq 5 -1 1); do mv -i image$i image_test_$[i+1]; done

Do it in reversing way to avoid overwritting. And better use “-i” to check overwrite.

 

 

 

 

Advertisements

About cgao

Cambridge, MA
This entry was posted in PC problem. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s