Does a file exist
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Does a file exist
I've been exporting files to my document folder, like " export image "seats" to file "seats.png" as PNG"
How can I tell if a file exists outside the app? The "exists" function work only with files inside LC.
Also, Is there a way to delete a file in my documents folder?
Max
How can I tell if a file exists outside the app? The "exists" function work only with files inside LC.
Also, Is there a way to delete a file in my documents folder?
Max
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Does a file exist
Hi Max,
Yes both we can
Best regards
Jean-Marc
Yes both we can
How can I tell if a file exists outside the app? The "exists" function work only with files inside LC.
Code: Select all
Answer (there is a file MyFilePath)
Also, Is there a way to delete a file in my documents folder?
Code: Select all
put specialfolderpath("documents") & "/" & MyFileName into MyFilePath
delete file MyFilePath
Jean-Marc
https://alternatic.ch
Re: Does a file exist
Thank you,
So simple, and so quick. This really helps.
So simple, and so quick. This really helps.
Re: Does a file exist
Hi
I am looking for something similar. I want to delete all files in a specific folder.
My code: This does not work.
Any help would be appreciated
Thanks
Peter G
I am looking for something similar. I want to delete all files in a specific folder.
My code: This does not work.
Code: Select all
on mouseUp
put specialFolderPath("documents") & "/" & "psendwip/" & "*.*" into tFilesToWipe
delete file tFilesToWipe
end mouseUp
Thanks
Peter G
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Does a file exist
Hi Peter,
To delete all files of a folder you have to get the list of files. You can do it with "the files" after you have defined target folder as default folder
Once you get this list you can use a loop to delete all files.
Something like that:
Best regards
Jean-Marc
To delete all files of a folder you have to get the list of files. You can do it with "the files" after you have defined target folder as default folder
Once you get this list you can use a loop to delete all files.
Something like that:
Code: Select all
on mouseUp
put specialFolderPath("documents") & "/" & "psendwip" into tFolder --psendwip = the name of folder target
set the folder to tFolder--define default folder
put the files into tAllFiles-- get list files
repeat for each line tOneFile in tAllFiles --a loop to delete all files
put tFolder & "/" & tOneFile into tPathFile
delete file tPathFile
end repeat
end mouseUp
Jean-Marc
https://alternatic.ch
Re: Does a file exist
Hi Jean-Marc
Many thanks
Works like a charm.
Really appreciate this.
Best
Peter G
Many thanks
Works like a charm.
Really appreciate this.
Best
Peter G