14 posts
Location
/home/nikov2002
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
7083 posts
Location
Tasmania (AU)
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.
14 posts
Location
/home/nikov2002
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)