Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TCL Command to delete multiple Directories

544 views
Skip to first unread message

gpa...@gmail.com

unread,
Sep 3, 2020, 8:39:34 AM9/3/20
to

I have to delete all 100 folders (namely run_000 to run_100 ) created by the project flow

Following command in a shell script removes the folders properly

\rm -rf ./product/p_1.results/run_*

How can i implement the same in a TCL script ?

Thanks in Advance
Parth

Ted Nolan <tednolan>

unread,
Sep 3, 2020, 9:24:20 AM9/3/20
to
In article <5cc323eb-df94-4d0c...@googlegroups.com>,
Well, you could just exec the same Unix "rm -rf" command from Tcl.

Failing that, the Tcl "file delete -force" command should do what you want.
--
columbiaclosings.com
What's not in Columbia anymore..

Rich

unread,
Sep 3, 2020, 9:58:32 AM9/3/20
to
The Tcl equivalent of your rm command above is:

file delete -force -- {*}[glob -nocomplain ./product/p_1.results/run_*]

Robert Heller

unread,
Sep 3, 2020, 9:58:46 AM9/3/20
to
foreach dir [glob -nocomplain ./product/p_1.results/run_*] {
file delete -force $dir
}

man n glob
man n file

>
> Thanks in Advance
> Parth
>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

greg

unread,
Sep 3, 2020, 1:05:00 PM9/3/20
to
from tcllib
fileutil::multi::op - Multi-file operation, scatter/gather

https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tcllib/files/modules/fileutil/multiop.md



Example (linux):
mkdir /tmp/backup/1
mkdir /tmp/backup/2
mkdir /tmp/backup/3


package require fileutil::multi::op
fileutil::multi::op tmpdel
tmpdel do remove the ? in /tmp/backup




Gregor

greg

unread,
Sep 3, 2020, 1:27:52 PM9/3/20
to
Am Donnerstag, 3. September 2020 14:39:34 UTC+2 schrieb gpa...@gmail.com:
#Example
package require fileutil::multi::op
fileutil::multi::op tmpdel
tmpdel do remove the run_* in ./product/p_1.results/

greg

unread,
Sep 3, 2020, 3:00:54 PM9/3/20
to
0 new messages