Directory
[1/12] from: sieglec::hotmail::com at: 14-Jan-2004 9:44
Why is it I cannot make a directory from an assigned variable name?
testVariable: "12312323"
make-dir %testVariable<
[2/12] from: Steven:White:ci:bloomington:mn:us at: 14-Jan-2004 9:16
The answer might be
make-dir to-file testVariable
Steven White
City of Bloomington
1800 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
[steven--white--ci--bloomington--mn--us]
>>> [sieglec--hotmail--com] 01/14/04 08:44AM >>>
Why is it I cannot make a directory from an assigned variable name?
testVariable: "12312323"
make-dir %testVariable
[3/12] from: juan-carlos:miranda:thalesatm at: 14-Jan-2004 16:22
Chris Siegle wrote:
>Why is it I cannot make a directory from an assigned variable name?
>
>testVariable: "12312323"
>
>make-dir %testVariable
>
make-dir to-file testVariable
if you want to create a Directory names 12312323 (there must be other
ways though. :) ).
The way you do it, REBOL doesn't recognize the word testVariable but
considers the variable %testVariable of type file!.
[4/12] from: joel:neely:fedex at: 14-Jan-2004 9:38
Hi, Chris,
Chris Siegle wrote:
> Why is it I cannot make a directory from an assigned variable name?
>
> testVariable: "12312323"
>
> make-dir %testVariable
The argument to MAKE-DIR should be a FILE! or URL! value, not a
STRING! value.
>> ? make-dir
USAGE:
MAKE-DIR path /deep
DESCRIPTION:
Creates the directory structure specified.
MAKE-DIR is a function value.
ARGUMENTS:
path -- (Type: file url)
REFINEMENTS:
/deep
(SPECIAL ATTRIBUTES)
catch
therefore,
testVariable: "12312323"
make-dir to-file testVariable
should work for you (assuming you have write permissions in the
current directory).
-jn-
--
----------------------------------------------------------------------
Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446
Enron Accountingg in a Nutshell: 1c=$0.01=($0.10)**2=(10c)**2=100c=$1
[5/12] from: sieglec:hotma:il at: 14-Jan-2004 11:03
Thank you for everyone's assistance!
[6/12] from: maximo:meteorstudios at: 14-Jan-2004 11:11
> -----Original Message-----
> From: Juan-carlos MIRANDA [mailto:[juan-carlos--miranda--thalesatm--com]]
> >make-dir %testVariable
> >
> >
> make-dir to-file testVariable
also note that a word is of a file! datatype, then you can use it as the base of a path
like so:
root: %/c/tmp/
root/filename.txt
== %/c/tmp/filename.txt
-MAx
[7/12] from: sieglec:hotma:il at: 14-Jan-2004 11:22
Does the same hold true for write/binary?
Example:
Temp: "FILENAME.TXT"
write/binary Temp data
[8/12] from: maximo:meteorstudios at: 14-Jan-2004 11:41
yes all file i/o need file specifications of type file!
-MAx
---
You can either be part of the problem or part of the solution, but in the end, being
part of the problem is much more fun.
[9/12] from: maximo:meteorstudios at: 14-Jan-2004 12:40
sorry, I forgot to say that they all also support URL!
Use the console's help as often as you can. its VERY usefull to know what a function
needs, does and it gives you a good cue as to if this is really the function you are
looking for...
Really, adopting this philosophy answers a lot of questions for me. I still use help
on the most basic functions time and time again, to be sure I don't miss any refinements.
(sometimes those refinements aren't obvious, but once you've tried one, you generally,
at least, rememeber what it does if you see it... I hadn't used all on mold so didn't
get what it did).
HTH!
-MAx
[10/12] from: ammon:addept:ws at: 14-Jan-2004 10:58
Yes, but the example you used still wouldn't work because your Temp variable
holds a String! value rather than a File! value so you would still need to
use TO-FILE. In most cases it would be better to just give your variable a
File! value like so:
Temp: %filename.txt
That way you wouldn't have to convert it but if you need your variable to be
a String! for some reason, just be sure to use TO-FILE like so:
write/binary to-file Temp data
HTH
~~Ammon ;->
[11/12] from: greggirwin:mindspring at: 14-Jan-2004 11:53
Hi Chris,
CS> Does the same hold true for write/binary?
You've gotten answers to this, but I'll add that one of the great
benefits of REBOL is its wide array of datatypes. Using them
effectively will make a big difference in how you use REBOL--not to
mention how you think and feel about it. :)
>> help datatype!
in the console will get you a list of datatypes. Look them up in the
Core docs and play with them to see how they work. Then look at how
the pseudo-types work (things like series! or any-block!), and how you
can use type-interrogation functions (e.g. any-string?, function?) to
determine type.
HTH!
-- Gregg
[12/12] from: sieglec:hotm:ail at: 14-Jan-2004 14:16
Many thanks!