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
 

Slartibart

macrumors 68040
Aug 19, 2020
3,140
2,815
just the names?

use:

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

in a terminal window.
 

dwig

macrumors 6502a
Jan 4, 2015
907
449
Key West FL
...
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.