Likes Likes:  0
Results 1 to 4 of 4

Thread: generating directory contents from Pi (Linux)

  1. #1
    Join Date
    May 2009
    State
    NSW
    Posts
    6,174
    Mentioned
    157 Post(s)
    Quoted
    1415 Post(s)

    generating directory contents from Pi (Linux)

    Wondering if anyone knows how to generate a text file within linux that list the contents of a directory ? My use is for generating a list of roms within a directory in a Retropie install (linux)

    Cheers,
    Jed

  2. #2
    Join Date
    Mar 2017
    State
    Victoria
    Posts
    2,635
    Mentioned
    65 Post(s)
    Quoted
    910 Post(s)
    For a [directory] and all sub directories into [filename]:

    Code:
    find [directory] -type f > [filename]
    or for a single directory just (That's a lower case LS) but it'll include the sub directory names:

    Code:
    ls [directory] > [filename]
    - - - Updated - - -

    You could also use the -maxdepth flag to find:
    Code:
    find [directory] -maxdepth 1 -type f > [filename]
    Using two >> will append to filename instead of overwriting it.

    - - - Updated - - -

    If you want to find just the zip files in a particular directory:

    Code:
    find [directory] -type f -iname \*.zip > [filename]
    If you want to strip the .zip off the filename:

    Code:
    find [directory] -type f -iname \*.zip | sed 's/\.zip//' > [filename]
    Live on Twitch, when I can at random times | twitch.tv/ajfclark | You can vote for what machine I play, click here, follow my channel and type '!vote' in chat for details | Movember: mobro.co/ajfclark

  3. #3
    Join Date
    May 2009
    State
    NSW
    Posts
    6,174
    Mentioned
    157 Post(s)
    Quoted
    1415 Post(s)

    awesome reply. thanks

  4. #4
    Join Date
    Mar 2017
    State
    Victoria
    Posts
    2,635
    Mentioned
    65 Post(s)
    Quoted
    910 Post(s)
    You're welcome.
    Live on Twitch, when I can at random times | twitch.tv/ajfclark | You can vote for what machine I play, click here, follow my channel and type '!vote' in chat for details | Movember: mobro.co/ajfclark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PC Engine RGB generating buzz on right audio channel
    By mamejay in forum Console Modding and Repair Help
    Replies: 5
    Last Post: 6th June 2011, 01:12 PM
  2. Help generating an artist-album list
    By Dutchy in forum Jukebox
    Replies: 4
    Last Post: 5th April 2010, 07:09 PM
  3. 'Mature' images in the snaps directory.
    By dmworking247 in forum Mame Cab Hardware and Software Discussion
    Replies: 10
    Last Post: 2nd September 2008, 01:12 PM
  4. Links Directory
    By Arcade King in forum Forum Information
    Replies: 0
    Last Post: 29th September 2007, 01:54 PM
  5. freeware directory compare
    By @lien_Zed in forum Computers
    Replies: 2
    Last Post: 29th June 2007, 08:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •