|
[Sponsors] |
June 19, 2020, 14:01 |
Renaming files in loop using scheme
|
#1 |
New Member
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6 |
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. |
|
June 19, 2020, 15:23 |
Renaming Files
|
#2 |
Senior Member
|
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.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 19, 2020, 16:24 |
|
#3 |
New Member
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6 |
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 |
|
June 19, 2020, 16:32 |
Format
|
#4 |
Senior Member
|
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.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 19, 2020, 16:45 |
|
#5 |
New Member
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6 |
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 ))) |
|
June 20, 2020, 12:04 |
format
|
#6 |
Senior Member
|
rename-file expects two arguments. So, you need to use format twice, working on each file separately.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 21, 2020, 22:33 |
format
|
#7 |
New Member
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6 |
Hi,
Sorry I didnt get you. So does that mean I cannot use rename in a loop? |
|
June 21, 2020, 22:47 |
format
|
#8 |
New Member
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6 |
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 |
|
Tags |
scheme language., scheme programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to understand high resolution scheme and high order scheme | iilw1314 | Main CFD Forum | 7 | April 12, 2022 13:29 |
can you tell me best gradient, pressure & momentum order selection in fluent | sanjiiv | FLUENT | 6 | February 14, 2020 07:07 |
Writing Case and Data Files Using Journal/Scheme Files | svp | Fluent UDF and Scheme Programming | 0 | April 5, 2011 12:04 |
Scheme documentation and question | Mickaël Perrin | FLUENT | 0 | July 4, 2002 06:21 |
[making animations] fclose fails to close files? | Mika | FLUENT | 0 | March 30, 2001 09:19 |