Folder Create and File Copy

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
I have another problem
When i add entrys within a listBox and close the application, When I open the application again i loose all entrys.
Is it because when i open the application, the code below creates and copies again.

I have the following code On Startup
Folder.Create("\C:\\My ZX Spectrum Catalogue Games");
File.Copy("AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);

sDatabaseFile = _SourceFolder .. "\\AutoPlay\\Docs\\SingleCases.db";
I have done a bit of reading about folder exists and file exists.

Do i need the application to check if the folder and file exists first if so how do i do this.
Hola mecivic!!
:sorry: no entiendo mucho de lo que explicas haya arriba pero con lo poco que entendí creo que lo que quieres es saber si la carpeta existe o no antes de ejecutar el código que mencionas.
Folder.DoesExist()
Folder.DoesExist es la solución a tu problema, con este código puede saber si una carpeta existe o no. En cuanto a lo de que al ejecutar tu programa después de cerrarlo, es normal que no se guarden los cambios hechos en el.
Más información: Folder.DoesExist
Una cosas más, por favor ¿podrías usar la etiqueta LUA para publicar código? :expolota
Normas del Foro
Hi
I am getting an error

I replaced my code with this.

<span class="posthilit">Folder</span>.<span class="posthilit">Create</span>("\C:\\My ZX Spectrum Catalogue Games");
File.Copy("AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);

sDatabaseFile = _SourceFolder .. "\\AutoPlay\\Docs\\SingleCases.db";




This is the error I get

Syntax Error: [Location="Project Actions", Event "On Startup", Line=1]
Error Detail: [unexpected symbol near '<'] in [<span class="posthilit">Folder</span>.<span class="posthilit">Create</span>("\C:\\My ZX Spectrum Catalogue Games");]
:yeah-1417757020: :chompy-1414025208:
if not Folder.DoesExist("C:\\My ZX Spectrum Catalogue Games") then
  File.Copy("AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);
end
sDatabaseFile = _SourceFolder .. "\\AutoPlay\\Docs\\SingleCases.db";
<span class="posthilit">Folder</span>.<span class="posthilit">Create</span>("\C:\\My ZX Spectrum Catalogue Games");


Y esto? para que es? :hypno: :hypno: :hypno: :hypno: :hypno:
Still getting an error

Syntax Error: [Location="Project Actions", Event "On Startup", Line=7]
Error Detail: [unexpected symbol near '<'] in [<span class="posthilit"><span class="posthilit">Folder</span></span>.<span class="posthilit"><span class="posthilit">Create</span></span>("\C:\\My ZX Spectrum Catalogue Games");]]


Can someone have a look at my apz please
HIDE: ON
Hidebb Message Hidden Description
Dowsher's code below don't give errors but it don't create the folder

if not Folder.DoesExist("C:\\My ZX Spectrum Catalogue Games") then
File.Copy("AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);
end
sDatabaseFile = _SourceFolder .. "\\AutoPlay\\Docs\\GameList.db";
Imagen
:hypno: :hypno: :hypno: :hypno: :hypno: :hypno: :hypno: :hypno: :hypno:
¿Y eso para qué es? Eso no es LUA ¿o sí?
mecivic escribió:Dowsher's code below don't give errors but it don't create the folder

if not Folder.DoesExist("C:\\My ZX Spectrum Catalogue Games") then
File.Copy("AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);
end
sDatabaseFile = _SourceFolder .. "\\AutoPlay\\Docs\\GameList.db";
mate mate, you are not thinking how are you coding the script read what you wrote its surrealist tell to engine "hey if folder does not exists then copy the files whatever you want to... a folder that does not exists!"
if Folder.DoesExist("C:\\My ZX Spectrum Catalogue Games") then
  File.Copy("AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);
else
 Folder.Create(put here the folder you set as target to copying files
end
Another way:
]if (Folder.DoesExist("C:\\My ZX Spectrum Catalogue Games")) == true  then
  File.Copy("AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);
else
 Folder.Create(put here the folder you set as target to copying files
end
Read the manual please and use a bit your brain, you could been go nuts
Si si gallumbo ,mucho royo... y el banner que te pedí que? :tumbleweed: :awthanks-1414025485: :yuno-1417754433: :sadtroll-1414023623:
:sorry: All for the questions.

I have tried carsonzillo's way and it creates the folder but Don't copy the GameList.db file.
The folder is empty. The GameList;db is in the Autoplay Docs ready to be copied but don't copy.

Have tried changing a few things but still no file copy to folder.

if Folder.DoesExist("C:\\My ZX Spectrum Catalogue Games") then
File.Copy("\\AutoPlay\\Docs\\GameList.db", "C:\\My ZX Spectrum Catalogue Games", true, true, false, true, nil);
else
Folder.Create("C:\\My ZX Spectrum Catalogue Games");
end
Ok, problema resuelto, para poder trabajar con carpetas en la raíz del Disco Local C: es necesario tener permisos de Administrador si no tiene permiso de Administrador no podrás copiar las carpeta y mucho menos crearla desde el programa.
hi

HIDE: ON
Hidebb Message Hidden Description


:penguin:
Thank you all for the help
abood1987 your a star

Thank you much appreciated.
thanks
rafaxplayer escribió:Si si gallumbo ,mucho royo... y el banner que te pedí que? :tumbleweed: :awthanks-1414025485: :yuno-1417754433: :sadtroll-1414023623:
:) jajajajajajajajajaja :)
Dime de que medidas lo quieres y yo te hago uno rafax xD
Ottima app complimenti
Important subject
nbbbbnjjhgggfddssqqwwetuiop´poiuytr