CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Renaming files in loop using scheme

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2020, 14:01
Default Renaming files in loop using scheme
  #1
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
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.
manish1308 is offline   Reply With Quote

Old   June 19, 2020, 15:23
Default Renaming Files
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 19, 2020, 16:24
Default
  #3
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
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
manish1308 is offline   Reply With Quote

Old   June 19, 2020, 16:32
Default Format
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 19, 2020, 16:45
Default
  #5
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
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 )))
manish1308 is offline   Reply With Quote

Old   June 20, 2020, 12:04
Default format
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 21, 2020, 22:33
Default format
  #7
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
Hi,
Sorry I didnt get you. So does that mean I cannot use rename in a loop?
manish1308 is offline   Reply With Quote

Old   June 21, 2020, 22:47
Default format
  #8
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
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
manish1308 is offline   Reply With Quote

Reply

Tags
scheme language., scheme programming


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 23:41.