Renaming files in loop using scheme
Hi I am trying to use scheme to rename my files.
I found the command (rename-file "first_file.csv" "second_file.csv"). This helps me to rename a single file. I want to use it in a loop to rename multiple files. How can I do that? I tried using something like this- (do ((x 2 (+ x 1))) ((> x3)) (rename-file ("Wallprof_Csv_~a.c" "output_~a.c" x x ))) But this does not work. Can you guys help me out with this. Thank you. |
Renaming Files
Why do you want to use Fluent to rename files? Use bash (or batch or powershell, if using Windows) to do that. Though it can be done yet Fluent is not meant for renaming files.
|
Hi,
I am running a do loop which has scheme commands to run the entire simulation. So I need to use the rename command in this do loop. Can you please let me know how can I use rename file in a do command. If I can get that done I am able to solve the whole issue. Can you please let me know how it is done in Fluent. It would be a great help. Thanks, Manish |
Format
The command does work the way you are using. However, if you want to replace ~a with some variable, you need to use format command.
|
Hi.
I am trying to use this command. But it is giving me an error. I also tried putting the whole thing in a bracket. (do ((x 2 (+ x 1))) ((> x 3)) (rename-file (format #f "test_~a.csv" "output_~a.csv" x x ))) |
format
rename-file expects two arguments. So, you need to use format twice, working on each file separately.
|
format
Hi,
Sorry I didnt get you. So does that mean I cannot use rename in a loop? |
format
Hello Sir,
I got what you were trying to imply. I was able use rename in the loop. Thank you so much from your help. Thank you, Manish |
All times are GMT -4. The time now is 03:18. |