Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wkenddad

macrumors newbie
Original poster
Feb 20, 2022
1
0
Anyone know how I can get the file names of files in a specific directory into a text or *.XML file.
I'd like to be able to get a list of the filenames in a directory into a database or Spreadsheet
I am working in IOS (Apple iMac)

Anu help would be appreciated
 
just the names?

use:

ls /where/ever/the/folder/is/ > /where/ever/you/want/the/file/saved/as/myfiles.txt

in a terminal window.
 
...
I am working in IOS (Apple iMac)

Anu help would be appreciated
??? Apple iMac = macOS iOS=not iMac

On macOS, I regularly just do a simple copy & paste into LibreOffice Calc with a little added trick.
  1. select one file in the folder
  2. CMD-A to select all
  3. CMD-C to copy
  4. In Calc, right-click on the desired first cell and select Paste Special > Unformatted Text to paste the filename text for the group of selected files.
Some applications don't support the standard Paste Special... function and some only offer it on the main application menu and not on the Context Menu so you'll need to explore the spreadsheet or text editor that you choose to use.

An alternate approach is to use a pure text editor like BBedit as in in between stage. With it, you simple CMD-V paste and it will only paste text (the filenames) as it doesn't support any of the other formats copied to the clipboard in Step 3, above. You can then select the text in BBedit, copy again, and do a simple paste in your target spreadsheet.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.