Results 1 to 5 of 5
  1. #1


    Member Since
    Jan 13, 2010
    Posts
    17
    Proper /dir listing from Terminal?
    When I generate a directory listing w/ a PC, i use cmd: "dir /b/s" and this will generate a list of my files with each file's path in front of it (ex: rootfolder\subfolder\file.txt). I can easily manipulate this in excel to upload files to my database with a directory command.

    How can I get the same results from Terminal? I have been using "ls -lR", and getting a list, however it only lists the parent folder once, then all file names beneath... then the next parent folder name, all file names, etc. I need to see the individual path in front of each file name that is generated.

    This has been stunting my progress for a while now, and any help is greatly appreciated!!

  2. #2

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,821
    Specs:
    Way... way too many specs to list.
    du -ah will do this (with human readable file sizes)

    example output:
    Code:
    mikeMBP-2:Installs mike$ du -ah
     16K	./.DS_Store
    2.0G	./adobepe9.dmg
     91M	./CEP-3.0-WacomEdition6-3.110.dmg
    264M	./ColorMunkiDisplay101.zip
     80M	./lensprofile_creator_p3_mac_042711.dmg
    1.0M	./lensprofile_downloader_p3_102510.air
     16K	./Lion installs/.DS_Store
    3.5G	./Lion installs/InstallESD.dmg
    3.5G	./Lion installs
    1.5M	./LionTweaks.zip
    7.0M	./LRMogrify2.lrplugin.zip
    10.0M	./onOne_PerfectPresets_LR.dmg
     69M	./PhotoTools_2.6.3_Free.pkg.zip
    120K	./Resuminator.zip
     61M	./sketch_pad_de_fr_en.dmg
    2.9M	./SuperDuper!.dmg
    8.0K	./Wacom_Brushes_3/.DS_Store
     12K	./Wacom_Brushes_3/Wacom Brushes 3 Readme.rtf
    312K	./Wacom_Brushes_3/Wacom Brushes 3.abr
    332K	./Wacom_Brushes_3
    6.1G	.
    There are probably a thousand ways to pull this off, it is Unix after all, but du's the easiest IMO.

    This also works well.

    Code:
    mikeMBP-2:Installs mike$ find . -type d -exec ls -lR  {} ';'
    total 5414304
    -rw-r--r--@ 1 mike  staff    95862481 Feb 16  2011 CEP-3.0-WacomEdition6-3.110.dmg
    -rw-r--r--@ 1 mike  staff   277045436 Sep 26 09:37 ColorMunkiDisplay101.zip
    -rw-------@ 1 mike  staff     7306367 Aug 27 20:45 LRMogrify2.lrplugin.zip
    drwxr-xr-x  4 mike  staff         136 Dec  1 20:11 Lion installs
    -rw-------@ 1 mike  staff     1562599 Sep 26 20:38 LionTweaks.zip
    -rw-------@ 1 mike  staff    72755047 Aug  7 23:20 PhotoTools_2.6.3_Free.pkg.zip
    -rw-------@ 1 mike  staff      121243 Sep 26 19:21 Resuminator.zip
    -rw-r--r--@ 1 mike  staff     3036322 Aug 16 19:12 SuperDuper!.dmg
    drwx------@ 5 mike  staff         170 Aug  7 21:49 Wacom_Brushes_3
    -rw-r--r--@ 1 mike  staff  2154935181 Feb 16  2011 adobepe9.dmg
    -rw-r--r--@ 1 mike  staff    83972878 Aug 23 22:27 lensprofile_creator_p3_mac_042711.dmg
    -rw-r--r--@ 1 mike  staff     1048833 Aug 23 22:27 lensprofile_downloader_p3_102510.air
    -rw-r--r--@ 1 mike  staff    10485760 Aug  8 09:07 onOne_PerfectPresets_LR.dmg
    -rw-r--r--@ 1 mike  staff    63967232 Mar 20  2009 sketch_pad_de_fr_en.dmg
    
    ./Lion installs:
    total 7310568
    -rw-r--r--@ 1 mike  staff  3743009943 Jul 20 06:37 InstallESD.dmg
    
    ./Wacom_Brushes_3:
    total 648
    -rwxr-xr-x  1 mike  staff    8453 Jun  8  2007 Wacom Brushes 3 Readme.rtf
    -rwxr-xr-x@ 1 mike  staff  317083 Jun 12  2007 Wacom Brushes 3.abr
    total 7310568
    -rw-r--r--@ 1 mike  staff  3743009943 Jul 20 06:37 InstallESD.dmg
    total 648
    -rwxr-xr-x  1 mike  staff    8453 Jun  8  2007 Wacom Brushes 3 Readme.rtf
    -rwxr-xr-x@ 1 mike  staff  317083 Jun 12  2007 Wacom Brushes 3.abr
    mike
    This machine kills fascists
    Got # ? phear the command line!

  3. #3


    Member Since
    Jan 13, 2010
    Posts
    17
    Major. Thanks a lot.

  4. #4


    Member Since
    Sep 13, 2011
    Location
    Kentucky, USA
    Posts
    100
    Specs:
    Mac Pro 2 x 2.66 Xeon 6gb DDR2 1TB OSX Server
    find can do the job in real simple without having to pipe outputs through awk if you are just need filepaths.

    Code:
    $ find .
    .
    ./.gitignore
    ./app
    ./app/assets
    ./app/assets/images
    ./app/assets/images/rails.png
    ./app/assets/javascripts
    ./app/assets/javascripts/application.js
    ./app/assets/javascripts/home.js.coffee
    ./app/assets/javascripts/posts.js.coffee
    ./app/assets/stylesheets
    ./app/assets/stylesheets/application.css
    ./app/assets/stylesheets/home.css.scss
    ./app/assets/stylesheets/posts.css.scss
    ./app/assets/stylesheets/scaffolds.css.scss
    ./app/controllers
    ./app/controllers/application_controller.rb
    ./app/controllers/home_controller.rb
    ./app/controllers/posts_controller.rb
    ./app/helpers
    Blair Technology Group - Mac System Administrator

  5. #5

    Dysfunction's Avatar
    Member Since
    Mar 17, 2008
    Location
    Tucson, AZ
    Posts
    6,821
    Specs:
    Way... way too many specs to list.
    Yeah, I always want file sizes and last modified dates. Habit, ya know.
    mike
    This machine kills fascists
    Got # ? phear the command line!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. choose.dir()
    By KivenWang in forum OS X - Development and Darwin
    Replies: 3
    Last Post: 06-08-2015, 08:01 PM
  2. Proper name for iTunes
    By MacRose in forum Running Windows (or anything else) on your Mac
    Replies: 2
    Last Post: 11-26-2010, 07:28 AM
  3. What is the proper pronunciation of his name?
    By dauber in forum Schweb's Lounge
    Replies: 12
    Last Post: 01-21-2010, 12:59 AM
  4. dir command
    By redsoxreed in forum OS X - Development and Darwin
    Replies: 4
    Last Post: 05-16-2008, 01:29 PM
  5. DIR-655 to APexpress faster than DIR-655 only?
    By Brandon in forum Internet, Networking, and Wireless
    Replies: 0
    Last Post: 10-07-2007, 06:53 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
  •