Hey, everyone-
I am very inexperienced with AppleScript, but I have an idea for a simple one that would be handy.
Would it be possible to make an AppleScript that, upon launch, presented a dialogue box, and for instance, if i enter “backup.zip,” it will simply delete the file backup.zip on a certain FTP directory, and quit?
set filevar to ""
tell application "Finder"
display dialog "Enter file name:" default answer filevar buttons ("Delete File") default button 1
set filevar to text returned of the result
end tell
do shell script "curl -Q 'DELE /stuff/$filevar ftp://user:password@myserver.com"
The shell script works when I enter a filename there, but it has to be a variable so it can use what was entered in the dialog box, and what I’m doing doesn’t work. How do I use the variable in this case?
I’m working on a script similar to this but i would actually like to delete a whole folder on an ftp server. I played with curl RMD but discovered that the directory must be empty first before it can be deleted.
I can get a list of the intended folder’s contents via :
set delDir to do shell script "curl -l " & ftpInfo & clientPath & folderName & "/"
set delDir to delDir's paragraphs --changes the unix curl -l list into a list format suitable for applescript
but how to go through a list like that and delete every item, and then delete the folder “folderName” is a bit beyond me.
Anyone know how to do it, or an alternate way entirely? (hopefully aside from SSH as i don’t want to have to prompt the user for a password if i can avoid it)