This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
laica10's profile picture

Sending Whole Directories trough recent

Started by laica10, 30 January 2016 - 09:42 AM
laica10 #1
Posted 30 January 2016 - 10:42 AM
Hey, i'm writing an updater for my program but my program has more
than just 1 file it uses other files in other directories, so i can't figure out
how i'm going to send a whole dir. trough rednet. Keeping i mind, other
files might be added in the future so i can't send it manually 1 by 1.
Edited on 30 January 2016 - 09:43 AM
Admicos #2
Posted 30 January 2016 - 10:53 AM
  • First, you can send a index of files & directories as two files thru rednet.
  • Then, you use a for loop to read the directory file line by line and create the directories from the file.
  • After creating the directories, read the file index line by line using a for loop and use rednet.receive to get a file.
  • Once you get the file, you create a file with the name of the contents in the current line in the file index. And write it there.
  • Continue the loop until the end of the file.
You may need to modify the update sender to send files in the correct order.
laica10 #3
Posted 30 January 2016 - 10:57 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
Edited on 30 January 2016 - 09:58 AM
Admicos #4
Posted 30 January 2016 - 11:02 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
  1. Don't nest too much
  2. Don't remember. Just write them in a file and send the file thrugh rednet.
Edited on 30 January 2016 - 10:02 AM
laica10 #5
Posted 30 January 2016 - 11:08 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
  1. Don't nest too much
  2. Don't remember. Just write them in a file and send the file thrugh rednet.

But how does the program then known wich dirs. still need to be done DIR -> dir1 -> sending
-> dir2 -> needs to be send
Admicos #6
Posted 30 January 2016 - 11:17 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
  1. Don't nest too much
  2. Don't remember. Just write them in a file and send the file thrugh rednet.

But how does the program then known wich dirs. still need to be done DIR -> dir1 -> sending
-> dir2 -> needs to be send
You create the directories before you send files.
laica10 #7
Posted 30 January 2016 - 11:40 AM
I'll let you know if i failed at it or if i succeeded, ok i'm going to test thisa bit
H4X0RZ #8
Posted 30 January 2016 - 11:50 AM
It would be much easier to use some compression API/program, and send the archive over rednet.
laica10 #9
Posted 30 January 2016 - 02:18 PM
Yeah, thanks i did it