Re: Copy file names in a folder to text edit?
Re: Copy file names in a folder to text edit?
- Subject: Re: Copy file names in a folder to text edit?
- From: Steve Mills <email@hidden>
- Date: Mon, 6 Oct 2003 14:13:09 -0500
On Monday, Oct 6, 2003, at 11:59 US/Central, Jacques Trindade wrote:
I'm really new to this apple script thing, and was wondering if any of
you
had a script available for copying all file names in a folder to a
TextEdit
document. I would really appreciate it if you could point me out where
to
find one if not. Thanks!
If you *just* need to get the file names into a text file and it
doesn't need to be automated, just select all the files in the folder
and Copy, then Paste into TextEdit. Note that it will most likely be
sorted in a completely goofy way, so if you're in OSX, switch to column
view first, then Copy.
But if you need to automate it, here's one way:
set fileNames to list folder "vol:folder you want to list:"
set num to count fileNames
open for access file "vol:dest:filenames.txt" with write permission
repeat with i from 1 to num
--Should be one line:
write ((item i of fileNames) as string) & return to file
"vol:dest:filenames.txt"
end repeat
close access file "vol:dest:filenames.txt"
There are many ways to do this, like if you want to save the script as
a droplet so you can just drop a folder onto it to write out the file
names, use an "on open" handler, loop through the items, and call the
above code.
Steve Mills
Drummer, Mac geek
http://sjmills5.home.mchsi.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.