Jump to content




Sending Whole Directories trough recent

wireless networking lua

8 replies to this topic

#1 laica10

  • Members
  • 19 posts

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 by laica10, 30 January 2016 - 10:43 AM.


#2 Admicos

  • Members
  • 207 posts
  • LocationTurkey

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.

#3 laica10

  • Members
  • 19 posts

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 by laica10, 30 January 2016 - 10:58 AM.


#4 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 30 January 2016 - 11:02 AM

 laica10, on 30 January 2016 - 10:57 AM, said:

yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,....
how could i solve this?
  • Don't nest too much
  • Don't remember. Just write them in a file and send the file thrugh rednet.

Edited by Admicos, 30 January 2016 - 11:02 AM.


#5 laica10

  • Members
  • 19 posts

Posted 30 January 2016 - 11:08 AM

 Admicos, on 30 January 2016 - 11:02 AM, said:

 laica10, on 30 January 2016 - 10:57 AM, said:

yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,....
how could i solve this?
  • Don't nest too much
  • 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

#6 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 30 January 2016 - 11:17 AM

 laica10, on 30 January 2016 - 11:08 AM, said:

 Admicos, on 30 January 2016 - 11:02 AM, said:

 laica10, on 30 January 2016 - 10:57 AM, said:

yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,....
how could i solve this?
  • Don't nest too much
  • 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.

#7 laica10

  • Members
  • 19 posts

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

#8 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 30 January 2016 - 11:50 AM

It would be much easier to use some compression API/program, and send the archive over rednet.

#9 laica10

  • Members
  • 19 posts

Posted 30 January 2016 - 02:18 PM

Yeah, thanks i did it





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users