Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create a folder in dersire path 1

Status
Not open for further replies.

stewang

Programmer
Aug 21, 2003
77
0
0
NZ
Hello all:
I got some problem as following, could anyone help me to solve the problem.Thanks.
How can I create and delete a directory in my desire path and open a folder in my desire path. And how can I check a directory whether exist or not .
I am using linux for my application now.
For example, I want to create a directory called newFolder and put it into path of
./home, so when I use the command of the
"set filename [tk_getOpenFile -defaultextension tcl -initialdir /home/newFolder ]",
it will bring out to me a dialog box which just contains a directory of the newFolder.
when I click a right mouse, I can delete a folder from the dialog box.

I known a command can create a directory as following, but it can not create a directory in my
desire path.
set newdir ?whatever?
exec mkdir $newdir

rgds
stewang
 
I know the under Windows the dialog opened by tk_getOpenFile permits some other operations as to rename or delete a file. But it's not the purpose of this command: tk_getOpenFile returns the path of a file to open (or an empty string).

To create/delete a directory it's better to use tk_chooseDirectory:
Code:
  set dir [tk_chooseDirectory]
  if {$dir != ""} { file mkdir/delete $dir }
HTH

ulis
 
Thanks ulis, it does work.

rgds
Stewang
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top