The standard Unix command ls lists filenames and directories in the specified directory. The default behaviour is to list just the filenames as including the full pathname would clutter the screen.
But sometimes you want the absolute paths. I need this all the time if I want to create a file containing a list fo filenames. The obvious command to get all the YAML files, for example, is:
$ ls -1 *yml
A.yml
B.yml
In order to get the full pathnames you need to use this:
$ ls -1 -d $PWD/*yml
/home/jones/A.yml
/home/jones/B.yml
A collection of computer systems and programming tips that you may find useful.
Brought to you by Craic Computing LLC, a bioinformatics consulting company.
Friday, January 27, 2012
Subscribe to:
Post Comments (Atom)
Contributors
Archive of Tips
-
►
2011
(44)
-
►
November
(11)
- strsplit in R
- Running R scripts on the Command Line
- Deleting a File that starts with '-' on UNIX
- Plotting a simple bar plot in R
- Captain Beefheart Song Titles
- When jQuery $.ajax() keeps returning the same valu...
- Updating a DIV with jQuery and Sinatra
- Latest version of jQuery on Google APIs
- Sorting on multiple String keys in Ruby
- Manipulating Model/Table/Controller Names in Rails...
- Parsing 96 / 384 well Plate Maps
-
►
February
(14)
- Rails, UTF-8 and Heroku
- Tables named with reserved words in MySQL
- Setting up PostgreSQL on Mac OS X 10.6
- Problem with sqlite when installing the taps ruby ...
- Rails, Devise and custom User models
- Basic image rollover effect in jQuery
- Authentication in Mongo and Mongoid
- Always index columns that you want to sort on in M...
- Using Mongoid in Ruby applications outside of Rail...
- Using Twitter for System Notifications
- PATSY - a web service that makes patents easier to...
- JavaScript Bookmarklet that can create a New Windo...
- Running a Ruby 1.9 Sinatra app on Heroku
- Ruby 1.9 and incompatible character encodings
-
►
November
(11)
1 comments:
Post a Comment