Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-23-2013, 12:32 AM   #16
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286

I think we little misunderstood it. Do you want full path of the file (including it's base directory name i.e. absolute path of the file) or only the file name?

If you need full path of the file, simply use the full path of base directory in find cmd, as:
~$ find /full/path/of/base_directory <expressions> <options>
On the other hand, if you need file names only i.e. file1, file2... etc. then you can give a try to (I didn't tested it):
~$ find /full/path/of/base_directory <expressions> <options> | basename -

Last edited by shivaa; 04-23-2013 at 12:34 AM.
Old 04-23-2013, 05:40 AM   #17
Registered: Mar 2010
Posts: 429

Original Poster
Rep: Reputation: 0
@shivaa I did try basename with pipe but doesn't work for me I thought it would be because it needs input so I tried with xargs but that also didn't worked but anyways -printf "%f\n" works beautifully so all good.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
find: paths must precede expression lead2gold Linux - General 11 02-27-2014 08:06 AM
[GNU find version 4.2.27] find: paths must precede expression mechagojira Linux - Newbie 3 07-06-2011 06:34 AM
find: paths must precede expression -- already checked google/man/faqs escalf Programming 5 03-02-2010 11:12 AM
Problem with find: paths must precede expression troelskn Programming 11 07-29-2009 03:48 AM
this regular expression means? bwreath Linux - General 2 03-15-2005 04:14 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:47 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration