CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

how to copy files or directories in a script using FOAM class

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2019, 14:02
Default how to copy files or directories in a script using FOAM class
  #1
New Member
 
Reza Nouri
Join Date: Oct 2012
Location: Tennessee
Posts: 26
Rep Power: 14
reza2031 is on a distinguished road
Send a message via Skype™ to reza2031
Hello,

I am modifying a solver in OpenFOAM and need to write a line to copy a directory. In Linux command line, it is easy and you can use:
Code:
cp -r directory1 directory2
But cp is not defined in Foam class. For example, in command line I can use "mkdir" to create a directory but in Foam class, I have to use "mkDir(path)".Is there any command or way to copy a directory?

Thank you,
Reza
reza2031 is offline   Reply With Quote

Old   November 22, 2019, 05:22
Default
  #2
Member
 
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15
einstein_zee is on a distinguished road
Hii reza,

take a look at cpFiles in https://github.com/OpenFOAM/OpenFOAM...ileOperation.H
einstein_zee is offline   Reply With Quote

Old   November 22, 2019, 13:28
Default
  #3
New Member
 
Reza Nouri
Join Date: Oct 2012
Location: Tennessee
Posts: 26
Rep Power: 14
reza2031 is on a distinguished road
Send a message via Skype™ to reza2031
Quote:
Originally Posted by einstein_zee View Post
Hii reza,

take a look at cpFiles in https://github.com/OpenFOAM/OpenFOAM...ileOperation.H
Hi Hosein,

Thank you for the life saving reply!
For future references, I used this in my code:
Code:
cp(mesh.time().path()/"originalCase", mesh.time().path()/"allCases"/"case1");
Reza
reza2031 is offline   Reply With Quote

Reply


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
SimpleFoam cannot open include file Marija OpenFOAM Running, Solving & CFD 1 October 28, 2020 11:35
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 21:30
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19


All times are GMT -4. The time now is 03:49.