Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Rebol doc: can't find how to copy a file ?

 [1/4] from: al::bri::xtra::co::nz at: 12-May-2001 10:21


laplace wrote:
> Is it possible to copy or move a file in Rebol ?
Try: write %/c/directory/file.txt read %/c/other-directory/myfile.txt Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [2/4] from: laplace:worldnet at: 11-May-2001 6:52


Hello, Is it possible to copy or move a file in Rebol ? I can't find it in rebol pdf .

 [3/4] from: arolls:bigpond:au at: 11-May-2001 17:09


Hi, You can use 'read and 'write. eg. source: read %path1/file.txt write %path2/file.txt source or simplified: write %path2/file.txt read %path1/file.txt Ok, that's for text, rebol code or data. For binary you should use /binary refinement on both read and write. eg. write/binary %path2/file.png read/binary %path2/file.png If the files are on the same volume, you can use rename. It's faster than the above method. eg. rename %/c/path1/file.png %/c/path2/file.png That will move it to the path2 directory. It also works for very large files, quickly. Files larger than memory, that need to be moved or copied to another volume, need to be copied in chunks. You use read/direct for that. Various people on this list have made file/directory utility functions, including me. I can't remember who, but I saw someone with a function for copying large files. You can check out my reb-site "Anton" http://users.bigpond.net.au/datababies/anton/rebol/index.r and find in there dir-utils.r, in which are some nice functions for roaming your disk. Not all are complete, however, I think you will find 'cp (file-copy) and 'ls (directory list) useful. Anton.

 [4/4] from: carl:rebol at: 11-May-2001 16:17


You can also use SET-MODES to keep the date the same on the new copy. At 5/12/01 10:21 AM +1200, you wrote: