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

Copying into /

Started by nikov2002, 22 June 2015 - 07:18 AM
nikov2002 #1
Posted 22 June 2015 - 09:18 AM
I'm getting errors with fs.move and fs.copy
I need to copy all the files from /temp/rootfs/* to / dir


fs.copy("/temp/rootfs/","") - is the line that outputs error
(string:40: file exists)

Any solve of it?

Full code:
http://pastebin.com/t97DpASY
Bomb Bloke #2
Posted 22 June 2015 - 09:29 AM
fs.copy() copies a file, or a directory. If you want to copy all the files in a directory, without copying the directory itself, then you'll need to use fs.list() to get all the file names, then call fs.copy() once for each of them.

You're currently trying to replace the root of your drive with the temp/rootfs folder - can't be done, as the root of your drive already exists, and you wouldn't want to do it even if that limitation were removed (allowing you to "overwrite"), as the new root directory would only have the contents of temp/rootfs.
nikov2002 #3
Posted 22 June 2015 - 09:32 AM
fs.copy() copies a file, or a directory. If you want to copy all the files in a directory, without copying the directory itself, then you'll need to use fs.list() to get all the file names, then call fs.copy() once for each of them…
Thanks for quick replying
I think it will be a good option to overwrite / (or just remount it)