• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: A more elegant file delete via AppleScript and FTP?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A more elegant file delete via AppleScript and FTP?


  • Subject: Re: A more elegant file delete via AppleScript and FTP?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 19 Sep 2006 09:03:25 -0400

On 9/19/06, Jeremy <email@hidden> wrote:
In attempting to remove temporary files created on my webserver by a
script, I have been struggling with the inelegance of my solution.  I
have a username with an @ in it so I'm not sure if I can create one of
the more elegant shell scripts to remove the files and I do not have
direct terminal access to the server (nor would I want the script to
have it as it will be distributed to my family members).

My first question is, why not do the deletion on the web server itself? Either run a script periodically, or maybe have the same script that creates them look for old ones and delete them, or write a CGI that deletes them that you can then run by pointing your web browser at it...

If you must use FTP, then there are still approximately five hundred
better ways to do it than launching and sending keystrokes to
Terminal.  :)  Here's a variant on Takaaki's solution:

do shell script "echo -e \"cd temporarydirectory\\nprompt off\\nmdel *.*\" |
                      ftp ftp://email@hidden:email@hidden";

Note that even with the @ in the username, you can still use an ftp://
URL; you just need to replace the @ with its URL-encoded equivalent
@.













tell application "Terminal" activate window do script "ncftp -u email@hidden -p password ftp.mydomain.com" in window 1 delay 10 tell application "System Events" tell process "Terminal" set frontmost to true keystroke "cd temporarydirectory" & return & "rm *.*" & return & "quit" & return & "n" & return end tell end tell delay 10 quit end tell

Is there a more straightforward solution than what I have above?

Thanks,

Jeremy

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden



--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: A more elegant file delete via AppleScript and FTP?
      • From: "Mark J. Reed" <email@hidden>
References: 
 >A more elegant file delete via AppleScript and FTP? (From: Jeremy <email@hidden>)

  • Prev by Date: Re: A more elegant file delete via AppleScript and FTP?
  • Next by Date: Re: A more elegant file delete via AppleScript and FTP?
  • Previous by thread: Re: A more elegant file delete via AppleScript and FTP?
  • Next by thread: Re: A more elegant file delete via AppleScript and FTP?
  • Index(es):
    • Date
    • Thread