From: CC Chen Date: 2012-04-12T13:51:25+09:00 Subject: loop naming for variable Hi all, I want to rename the file name if the file is exist. If filexample.txt exist, the original filexample.txt will be renamed to filexample_1.txt. And I set a variable mapping to one download path --> "local_file_1 = local_path +'/'+ filename + '_1'". How to re-write below code by for-loop or while? local_path ="/home/usr" local_file_1 = local_path +'/'+ filename + '_1' local_file_2 = local_path +'/'+ filename + '_2' local_file_3 = local_path +'/'+ filename + '_3' .... local_file_n = local_path +'/'+ filename + '_n' Thanks, Regards, -- Posted via http://www.ruby-forum.com/.