i want rename file in system scala code. equivalent of can done bash like,
mv old_file_name new_file_name i not asking renaming scala source code file, file residing in system.
consider
import java.io.file import util.try def mv(oldname: string, newname: string) = try(new file(oldname).renameto(new file(newname))).getorelse(false) and use with
mv("oldname", "newname") note mv returns true on successful renaming, false otherwise. note try catch possible io exceptions.
Comments
Post a Comment