Timeline for bash find: get directory of found file
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 9, 2018 at 10:16 | answer | added | Sekar Ramu | timeline score: 0 | |
| Jan 23, 2015 at 23:14 | history | edited | Gilles 'SO- stop being evil' |
edited tags
|
|
| Jan 23, 2015 at 12:06 | vote | accept | dubbelj | ||
| Jan 23, 2015 at 11:11 | comment | added | Costas | @StéphaneChazelas Thanks. I didn't know such limitation for OS/X (BSD). Poor poor mac' users! | |
| Jan 23, 2015 at 11:07 | comment | added | Stéphane Chazelas |
@Costas, -printf is GNU-only. The OP's mentioning OS/X (a BSD system).
|
|
| Jan 23, 2015 at 10:45 | comment | added | Costas |
find ./ -name "foo.mp4" -printf "%h\n" will print path to for each found file (one by line). More over as usual nobody use -exec echo {} therefore there is -print (default even omitted) or printf action.
|
|
| Jan 23, 2015 at 10:45 | answer | added | Stéphane Chazelas | timeline score: 36 | |
| Jan 23, 2015 at 10:37 | review | First posts | |||
| Jan 23, 2015 at 11:27 | |||||
| Jan 23, 2015 at 10:36 | comment | added | dubbelj | Could you show an example of that? Should I put that behind '-exec' or before? | |
| Jan 23, 2015 at 10:32 | comment | added | Costas |
man find (ACTIONS): -printf %h Leading directories of file's name (all but the last element). If the file name contains no slashes (since it is in the current directory) the %h specifier expands to ".".
|
|
| Jan 23, 2015 at 10:27 | history | asked | dubbelj | CC BY-SA 3.0 |