Home   Archive   Permalink



File/Directory handling problem

I,m new to Rebol and this is my first attempt to program with it. I would appreciate any help that someone can provide on the following:
    
Rebol Console seems to tell me the file doesn't exist when it really does. I'm doing something wrong here but I can't seem to resolve it. Code and execution follows:
    
REBOL/View 2.7.8.3.1 1-Jan-2011
Copyright 2000-2011 REBOL Technologies. All rights reserved.
REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
>> R E B O L []
== []
>> Probe Find %"/C/Users/Robert Wiggins/AppData/Roaming/Microsoft/CFSWW1 Over Flanders Fields/CFS3.xca"
none
== none
>> what-dir
== %/C/Users/Public/Rebol%20Utils/rebol/view/
>> list-dir

posted by:   Robert Wiggins     23-Dec-2012/19:33:06-8:00



Addendum to last post:
    
I'm runing Windows Vista Ultimate and my Rebol.exe has "Run as Administrator" defined so hopefully I'm not experiencing an "Auth" problem.

posted by:   Robert Wiggins     23-Dec-2012/19:36:56-8:00



Did you try just using PROBE without FIND? I'm not on Windows, but FIND and PROBE FIND both give none as the result with a known file. PROBE by itself, however, does return the complete path to the file.

posted by:   human being     23-Dec-2012/20:56:57-8:00



Hi Robert,
    
You shouldn't use quotes in a file type. You can use either of these to refer to the file:
    
to-file "/C/Users/Robert Wiggins/AppData/Roaming/Microsoft/CFSWW1 Over Flanders Fields/CFS3.xca"
    
%/C/Users/Robert%20Wiggins/AppData/Roaming/Microsoft/CFSWW1%20Over%20Flanders%20Fields/CFS3.xca

posted by:   Nick     23-Dec-2012/22:50:41-8:00



Nick's suggestion of using "to-file" worked for me. Thanks for the response folks, it is appreciated.
    
I have one more ? I want to copy a file from one location on a disk to another location. I'm not sure if I should be using "Read" and "Write" to do this. I just want to do a sort of backup of a file. Any recommendations?? Thanks

posted by:   Robert Wiggins     24-Dec-2012/9:27:06-8:00



Hi Robert,
    
You can do:
    
write %backup.fil read %source.fil
    
or, if it's a binary file:
    
write/binary %backup.fil read/binary %source.fil

posted by:   Nick     1-Jan-2013/21:38:18-8:00



to my knowledge, you can use quotes to specify files with spaces. It's still a file! if the % is before.
    
>> equal? %"/c/windows" %/c/windows
== true
    
>> equal? %"/c/program files (x86)/" to-rebol-file "c:\program files (x86)\"
== true

posted by:   DideC     9-Jan-2013/6:51:21-8:00