List files only using terminal

Discussion in 'macOS' started by djnickburrett, Feb 4, 2015.

  1. djnickburrett macrumors newbie

    Joined:
    Feb 4, 2015
    #1
    Hello

    I would like to list the files in the folders and sub folders of my iTunes Media folder.

    I don't want to list the folders, just the files - is that possible?

    Thanks in anticipation
    Nick
     
  2. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #2
    You'd need to use the ls command but a quick review of the man pages, doesn't seem to indicate any way to only list files not directories. I'm sure there's a way, I'm just not familiar with it enough :(
     
  3. djnickburrett thread starter macrumors newbie

    Joined:
    Feb 4, 2015
    #3
    Hello

    Is there a way round it with another application?
     
  4. leman macrumors 604

    Joined:
    Oct 14, 2008
    #4
    Use

    Code:
    find . -type f
    
    or more specifically, for the iTunes Media

    Code:
    find ~/Music/iTunes/iTunes\ Media/Music -type f
    
    Refer to find command manpage for more info (careful: its a VERY flexible command ;) )
     
  5. djnickburrett thread starter macrumors newbie

    Joined:
    Feb 4, 2015
    #5
    Hello

    Code:
    find ~/Music/iTunes/iTunes\ Media/Music -type f
    That is very useful indeed. Is it possible to exclude hidden files such as .DS_Store
     
  6. leman macrumors 604

    Joined:
    Oct 14, 2008
    #6
    One way to exclude hidden files and directories is

    Code:
    find ~/Music/iTunes/iTunes\ Media/Music -type f -not -path '*/\.*'
    
     
  7. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #7
    Are you looking to list just the music files but not the folders? If so, that's simple to do with Finder and TextEdit.
     

Share This Page