LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue May 14, 2002 7:37 pm Post subject: Create directory with sub directories |
|
|
Here is a snip that I posted on the old board to create
a directory with sub directories. If the directory is
NOT created successfully %%direrror is set to 1.
| Code: |
rem -- All you need to do is set the Variable %%InstallDir
rem -- to a path [%%installDir = C:\Program Files\MyProg\Bitmaps\Sunsets]
rem -- Then call CreatDir as a sub
:CreateDir
%%len = @len(%%InstallDir)
list create,15
repeat
%%pos = @pos("\",%%InstallDir)
if @greater(%%pos,0)
%%seg = @substr(%%InstallDir,1,@pred(%%pos))
list add,15,%%seg
%%installdir = @substr(%%InstallDir,@succ(%%pos),%%len)
%%len = @len(%%InstallDir)
else
list add,15,%%InstallDir
end
until @equal(%%pos,0)
%%drive = @item(15,0)
list seek,15,0
list delete,15
%%cnt = @count(15)
%%x = 0
repeat
if @item(15,%%x)
if %%tdir
%%tdir = %%tdir"\"@item(15,%%x)
if @not(@file(%%tdir,D))
directory create,%%tdir
if @not(@ok())
%%direrror = 1
end
end
else
%%tdir = %%drive"\"@item(15,%%x)
if @not(@file(%%tdir,D))
directory create,%%tdir
if @not(@ok())
%%direrror = 1
end
end
end
end
%%x = @succ(%%x)
until @equal(%%x,%%cnt)
%%tdir =
list close,15
exit
|
_________________ Chris
Http://theblindhouse.com |
|