Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > gathering multiple file's names as text

gathering multiple file's names as text
Thread Tools
Andrew Sin
Fresh-Faced Recruit
Join Date: Jan 2003
Location: Endsmouth
Status: Offline
Reply With Quote
Nov 26, 2003, 03:15 PM
 
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-
     
Developer
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status: Offline
Reply With Quote
Nov 26, 2003, 03:56 PM
 
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.
     
ppmax
Dedicated MacNNer
Join Date: Nov 1999
Status: Offline
Reply With Quote
Nov 26, 2003, 04:20 PM
 
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
     
Andrew Sin  (op)
Fresh-Faced Recruit
Join Date: Jan 2003
Location: Endsmouth
Status: Offline
Reply With Quote
Nov 26, 2003, 05:20 PM
 
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-
     
Scarpa
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Nov 26, 2003, 06:00 PM
 
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
     
Developer
Addicted to MacNN
Join Date: Apr 2001
Location: europe
Status: Offline
Reply With Quote
Nov 26, 2003, 06:17 PM
 
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.
     
:XI:
Mac Elite
Join Date: Sep 2002
Status: Offline
Reply With Quote
Nov 26, 2003, 09:40 PM
 
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!
     
Hop Pocket
Forum Regular
Join Date: Sep 2003
Status: Offline
Reply With Quote
Nov 26, 2003, 09:46 PM
 
Wow. I have learned a lot in this thread. Thanks to all!
     
Jim_MDP
Mac Enthusiast
Join Date: Jul 2003
Location: Kali
Status: Offline
Reply With Quote
Nov 27, 2003, 02:52 AM
 
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.
     
Cipher13
Registered User
Join Date: Apr 2000
Status: Offline
Reply With Quote
Nov 27, 2003, 03:44 AM
 
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.
     
Scarpa
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Nov 27, 2003, 04:03 AM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:55 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,