Re: Listing Files, Deleting Files
Re: Listing Files, Deleting Files
- Subject: Re: Listing Files, Deleting Files
- From: Philip Aker <email@hidden>
- Date: Fri, 7 Aug 2009 23:38:01 -0700
On 2009-08-07, at 16:06:27, Andrew P wrote:
Is there any way I could insert a variable at the end of the path to
the folder? Say, for a folder in the actual folder that I wanted to
zip?
For example:
set theFolder to text returned of (display dialog "Type the name of
the folder to delete the hidden files from." default answer "Folder
name" buttons "OK" default button 1)
(* To allow the user to define the folder to be zipped. *)
(*
(Insert script to delete the hidden files here) path to folder
"/Users/apodgorski/Desktop/Folder/--Variable theFolder here--" as
alias
*)
Yes. The string concatenation operator is "&". If using AppleScript,
then you should be sure of the path style. In many cases, there isn't
an auto-coercion between a POSIX path style and an HFS path style.
Also, if you're going to be pumping these things out to a well known
folder, such as the desktop, it's much better to use the built-in
'path to' command to attain the path.
set dir_name to text returned of (display dialog …
set target_dir to (path to desktop folder as text) & dir_name
…
set src to POSIX path of target_dir
set dst to src & ".zip"
do shell script "ditto -ck " & quoted form of src & space & quoted
form of dst
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden