CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

how to delete all folders of same type?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By wyldckat
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2013, 16:43
Default how to delete all folders of same type?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
whats the command to delete all folders of a postProcessing result in time folders after seeing and use?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 15, 2013, 18:14
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

Sorry, but your question is too ambiguous
Can you describe in more detail?

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   June 15, 2013, 18:33
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
for example the folders that originated by "Co"(courant number) command.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 15, 2013, 19:17
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
I've tested running Co with the tutorial case "incompressible/icoFoam/cavityGrade" and it only created the field files "Co" in the already existing time folders. To remove these field files, you can do the following command:
Code:
rm */Co
You can see what this command actually does, by running:
Code:
echo rm */Co

But if it does create new folders, them the trick should be to first remove the files that were created, by using the command above; and then remove the empty directories with the following command:
Code:
for a in *; do rmdir $a; done
It will give several messages indicating that certain files/folders cannot be removed, simply because they are not empty or are not folders. In other words, rmdir will only delete the empty folders.
immortality likes this.
__________________
wyldckat is offline   Reply With Quote

Old   June 19, 2013, 10:05
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
could you describe me a bit about it?
Code:
for a in *; do rmdir $a; done
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 20, 2013, 17:41
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

It's the same as doing:
Code:
for a in *
do
    rmdir $a
done
To know more about each command:
Code:
help for
man rmdir
In essence:
  • The asterisk lists all files and folders in the current folder. You can see this if you run:
    Code:
    echo *
  • rmdir removes empty directories.
  • "for" is ... it is a for cycle!? Not sure how to explain this one, since it's command to several programming languages.
For more information on how to program in the bash shell... Google?

Best regards,
Bruno
immortality likes this.
__________________
wyldckat is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
[swak4Foam] Air Conditioned room groovyBC Sebaj OpenFOAM Community Contributions 7 October 31, 2012 15:16
turbulent jet simulation antonio_ing OpenFOAM Running, Solving & CFD 5 September 16, 2010 03:31
rhoSimpleFoam claco OpenFOAM 7 April 20, 2010 05:32
pipe flow with heat transfer Fabian OpenFOAM 2 December 12, 2009 05:53


All times are GMT -4. The time now is 02:20.