Page 1 of 1
Help!
Posted: Fri Apr 18, 2014 4:00 pm
by Alex_CTZ
How can i delete a folder with item in it.
I know about the
but that only seems to work when it is empty.
Also,
For some reason open file and launch file
wont open a .log file
how can I make it so when a user presses a button it opens a file?
-Thanks
Re: Help!
Posted: Fri Apr 18, 2014 4:16 pm
by Mark
Hi Alex,
If you change your title into some descriptive text, you'll get more help.
You need to delete the files in the folder before you can delete the folder.
Use a different file extension or use different syntax:
Code: Select all
launch documentPath with applicationPath
Kind regards,
Mark
Re: Help!
Posted: Fri Apr 18, 2014 4:37 pm
by Alex_CTZ
Mark wrote:Hi Alex,
If you change your title into some descriptive text, you'll get more help.
You need to delete the files in the folder before you can delete the folder.
Use a different file extension or use different syntax:
Code: Select all
launch documentPath with applicationPath
Kind regards,
Mark
Is there a way to delete each file without specifying the name and path. As there are over 500 files that names change :/
-Thanks
Re: Help!
Posted: Fri Apr 18, 2014 4:47 pm
by magice
This may help.
http://lessons.runrev.com/s/3527/m/4067 ... ers-part-1 I think a list of the files in the folder is what you need.
Re: Help!
Posted: Fri Apr 18, 2014 4:48 pm
by Klaus
Hi Alex,
Alex_CTZ wrote:Is there a way to delete each file without specifying the name and path. As there are over 500 files that names change :/
use a repeat loop over a list of "the files"!
Something like this:
Code: Select all
...
put "C:/pathHere" into tPath
put the folder into tOldDirectory
set the folder to tPath
put the files into tFiles
repeat for each line i in tFiles
delete file i
end repeat
set folder to tOldDirectory
delete folder tPath
...
Best
Klaus
Re: Help!
Posted: Fri Apr 18, 2014 4:51 pm
by Mark
Alex,
suppose that the variable myPath contains the path to the folder. You can use this script to delete all files:
Code: Select all
set the itemDel to slash
set the defaultFolder to myPath
put the files into myFiles
filter myFiles without "."
filter myFiles without ".."
repeat for each line myFile in myFiles
delete file myFile
end repeat
set the defaultFolder to item 1 to -2 of myPath
delete folder myPath
Kind regards,
Mark
Re: Help!
Posted: Fri Apr 18, 2014 4:52 pm
by Mark
Klaus,
What if the old directory is the same as the folder that is to be deleted?
Mark
Re: Help!
Posted: Fri Apr 18, 2014 4:54 pm
by Klaus
Hi Mark,
Mark wrote:What if the old directory is the same as the folder that is to be deleted?

well, that wouldn't affect me, personally, at all!
Best
Klaus
Re: Help!
Posted: Fri Apr 18, 2014 4:58 pm
by Alex_CTZ
Thanks so much all!, I am really happy I chose Livecode to start out with as the help community is the best

Thanks again
-Alex