linux - Unix Renaming Files -
i want rename files in folder on unix using script.
format of original file is:
abc.txt.temp
and want rename to:
abc.txt
many files use format , want remove .temp original file name.
the answer ciprian gave option feel it's limiting. solution below more flexible don't have count , can remove text position rather end.
the following command (1 line) remove mention of .temp in files:
for filename in *; mv "$filename" "${filename//.temp/}"; done
note "*" means files in current folder. can use *.temp achieve same result ciprian's method. (that is, removing .temp files ending .temp)
Comments
Post a Comment