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

Divide a file

 [1/2] from: castellani-cpt::itautec-philco::com::br at: 10-Dec-2003 9:47


Hi guys I need to upload an file to my FTP site but I need to divide this file in multiple files. For example, if file have 2048 KB I need to divide it in 2 (1024 and 1024). I can do it with Rebol, ok ? If I can, how can I do ?... Thanks and a hug...

 [2/2] from: rebolview:yah:oo at: 10-Dec-2003 15:29


Please find this little part of code : REBOL [] fsplit: get in context [ fsplit: func [ {split the file in files with names root-name1 root-name2 ... of block-size length. } file root-name block-size /local source-file data destination-file file-count file-name ] [ file-count: 0 source-file: open/read/binary/direct/no-wait file while [data: copy/part source-file block-size] [ file-count: file-count + 1 file-name: rejoin [to-file root-name file-count] destination-file: open/write/binary/direct file-name insert destination-file data close destination-file ] close source-file ] ] 'fsplit ; fsplit c:\winzip.log "winziplog" 16384 ; split winzip.log file in files winziplog1 winziplog2 ... of 16Kb length Hope this help ! -yos Marcelo Fontes Castellani <[castellani-cpt--itautec-philco--com--br]> wrote: Hi guys I need to upload an file to my FTP site but I need to divide this file in multiple files. For example, if file have 2048 KB I need to divide it in 2 (1024 and 1024). I can do it with Rebol, ok ? If I can, how can I do ?... Thanks and a hug...