Página 1 de 2
Folder Create and File Copy
Publicado: 18 Ene 2015 22:23
por mecivic
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.
Re: Folder Create and File Copy
Publicado: 18 Ene 2015 23:42
por Dow Sher
Hola
mecivic!!
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 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?
Normas del Foro
Re: Folder Create and File Copy
Publicado: 20 Ene 2015 00:08
por mecivic
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");]
Re: Folder Create and File Copy
Publicado: 20 Ene 2015 04:19
por Pabloko
Re: Folder Create and File Copy
Publicado: 20 Ene 2015 05:20
por Dow Sher
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";
Re: Folder Create and File Copy
Publicado: 20 Ene 2015 08:11
por rafaxplayer
Re: Folder Create and File Copy
Publicado: 20 Ene 2015 22:06
por mecivic
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
Re: Folder Create and File Copy
Publicado: 20 Ene 2015 23:34
por mecivic
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";
Re: Folder Create and File Copy
Publicado: 21 Ene 2015 05:50
por Dow Sher
¿Y eso para qué es? Eso no es LUA ¿o sí?
Re: Folder Create and File Copy
Publicado: 21 Ene 2015 17:14
por carsonzillo
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
Re: Folder Create and File Copy
Publicado: 21 Ene 2015 17:42
por rafaxplayer
Re: Folder Create and File Copy
Publicado: 21 Ene 2015 22:40
por mecivic
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
Re: Folder Create and File Copy
Publicado: 22 Ene 2015 05:58
por Dow Sher
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.
Re: Folder Create and File Copy
Publicado: 22 Ene 2015 20:16
por abood1987
hi
- HIDE: ON
- Hidebb Message Hidden Description
Re: Folder Create and File Copy
Publicado: 22 Ene 2015 20:51
por mecivic
Thank you all for the help
abood1987 your a star
Thank you much appreciated.
Re: Folder Create and File Copy
Publicado: 22 Ene 2015 21:56
por samirmax
thanks
Re: Folder Create and File Copy
Publicado: 26 Ene 2015 21:26
por Dow Sher
jajajajajajajajajaja
Dime de que medidas lo quieres y yo te hago uno
rafax xD
Re: Folder Create and File Copy
Publicado: 11 Ene 2017 00:13
por cicciobello
Ottima app complimenti
Re: Folder Create and File Copy
Publicado: 10 Abr 2017 07:53
por souhaib
Important subject
Re: Folder Create and File Copy
Publicado: 10 Oct 2018 01:59
por jhonny mejia
nbbbbnjjhgggfddssqqwwetuiop´poiuytr