|
|
gathering multiple file's names as text
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2003
Location: Endsmouth
Status:
Offline
|
|
I'm not sure if this is even possible...
I work for a design/printing company with a large amount of archived files. We want to take the file names of our archived jobs and make them into a text file so we can have an editable list. Is there an easier way to do this besides copying and pasting each individual file name? We are using OS X 10.2.6
Thanks for any help
-A-
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status:
Offline
|
|
Copy this into Scripteditor:
Code:
on open these_items
set the_names_list to ""
repeat with i from 1 to count of these_items
set this_item to item i of these_items
tell application "Finder" to set the_filename to the name of this_item
set the_names_list to the_names_list & the_filename & "\n"
end repeat
set the clipboard to the_names_list
say "The list of filenames is now on the clipboard."
end open
Save it as program and drop the files onto it.
|
Nasrudin sat on a river bank when someone shouted to him from the opposite side: "Hey! how do I get across?" "You are across!" Nasrudin shouted back.
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 1999
Status:
Offline
|
|
Or do a "man find" or "man locate" in the Terminal.
You could do something like:
find /path/to/the/archive/* -type f -name '*.[jJ][pP][gG]' > /path/to/output/text/file/output.txt
This would look in a particular folder and find all the jpg files and write all the names into the output.txt file
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2003
Location: Endsmouth
Status:
Offline
|
|
Originally posted by Developer:
Copy this into Scripteditor:
Code:
on open these_items
set the_names_list to ""
repeat with i from 1 to count of these_items
set this_item to item i of these_items
tell application "Finder" to set the_filename to the name of this_item
set the_names_list to the_names_list & the_filename & "\n"
end repeat
set the clipboard to the_names_list
say "The list of filenames is now on the clipboard."
end open
Save it as program and drop the files onto it.
Awesome!
Thank you so much Developer. That did exactly what we needed. Thank you also, ppmax. I didn't get a chance to use your method since Developer's worked and we are really busy here, but I really appreciate your reply.
Thanks again.
-A-
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Aug 2002
Status:
Offline
|
|
The battle of the scripting languages is cool and all, but this functionality is built into Finder!
1. Select the files
2. Press Command-C
3. Paste into editor of choice
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status:
Offline
|
|
I feel so ashamed.
|
Nasrudin sat on a river bank when someone shouted to him from the opposite side: "Hey! how do I get across?" "You are across!" Nasrudin shouted back.
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Sep 2002
Status:
Offline
|
|
Originally posted by Scarpa:
The battle of the scripting languages is cool and all, but this functionality is built into Finder!
1. Select the files
2. Press Command-C
3. Paste into editor of choice
But, that's what I was going to post!
haha!
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Sep 2003
Status:
Offline
|
|
Wow. I have learned a lot in this thread. Thanks to all!
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Jul 2003
Location: Kali
Status:
Offline
|
|
Yes, and if you want all the nested files listed as well� drag the folder to a new window in BBEdit, or possibly any other HTML style editor.
So there.
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Apr 2000
Status:
Offline
|
|
Originally posted by Scarpa:
The battle of the scripting languages is cool and all, but this functionality is built into Finder!
1. Select the files
2. Press Command-C
3. Paste into editor of choice
Indeed. Been around since OS9.
In OSX, it pastes the filenames if it is not appropriate to paste the FILES themselves (ie, if you're pasting in the Finder, it'll use the files; otherwise, just their names).
You could also just:
ls > files.txt
or whatever.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Aug 2002
Status:
Offline
|
|
Originally posted by Developer:
I feel so ashamed.
Don't be, I liked your script. It was interesting to see the difference between Apple tools and UNIX tools. Makes ya wonder how OSX ever happened!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|