Find recursively in folders, subfolders and multiple files [duplicate]
This question already has an answer here:
How to Search for Files Recursively into Subdirectories
4 answers
How do you output the filename in find command while using -exec?
7 answers
I want to find all html
files and only show the file names, not the full file path, what I tried:
find /home/irakli/Desktop/irakli_linux -print | grep -i '.*[.]html'
Results:
/home/irakli/Desktop/irakli_linux/htmll/10.html
/home/irakli/Desktop/irakli_linux/htmll/11.html
/home/irakli/Desktop/irakli_linux/htmll/12.html
/home/irakli/Desktop/irakli_linux/htmll/13.html
/home/irakli/Desktop/irakli_linux/htmll/14.html
/home/irakli/Desktop/irakli_linux/htmll/15.html
I only want 1.html 2.html
...
command-line find
New contributor
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 11:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to Search for Files Recursively into Subdirectories
4 answers
How do you output the filename in find command while using -exec?
7 answers
I want to find all html
files and only show the file names, not the full file path, what I tried:
find /home/irakli/Desktop/irakli_linux -print | grep -i '.*[.]html'
Results:
/home/irakli/Desktop/irakli_linux/htmll/10.html
/home/irakli/Desktop/irakli_linux/htmll/11.html
/home/irakli/Desktop/irakli_linux/htmll/12.html
/home/irakli/Desktop/irakli_linux/htmll/13.html
/home/irakli/Desktop/irakli_linux/htmll/14.html
/home/irakli/Desktop/irakli_linux/htmll/15.html
I only want 1.html 2.html
...
command-line find
New contributor
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 11:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
@Sergiy I doubt this is a duplicate of How to Search for Files Recursively into Subdirectories. This one particularly asks how to print just the filename (without the path) while the other one asks forfind
in general.
– PerlDuck
Dec 30 '18 at 11:56
@PerlDuck Admittedly, the many top answers don't mention printing only filename without path, however IMHO it's a matter of reading the manual and adding proper flag to the command. I have, however, edited my own answer there to mention some of the flagsfind
has, so hopefully that covers it. Alternatively, askubuntu.com/a/651321/295286 would probably be a more appropriate, and it pretty much same question in the title. Feel free to vote on reopening, though.
– Sergiy Kolodyazhnyy
Dec 30 '18 at 12:01
@SergiyKolodyazhnyy Congrats oncommand-line
gold :) This seems more of a duplicate for printing basename only?
– WinEunuuchs2Unix
Dec 30 '18 at 14:46
@WinEunuuchs2Unix Hi, thanks. I've hadcommand-line
gold for about 2-3 years now. Check the list of duplicates to this post - there's two, How do you output the filename in find command while using -exec? addresses that issue.
– Sergiy Kolodyazhnyy
Dec 30 '18 at 22:53
add a comment |
This question already has an answer here:
How to Search for Files Recursively into Subdirectories
4 answers
How do you output the filename in find command while using -exec?
7 answers
I want to find all html
files and only show the file names, not the full file path, what I tried:
find /home/irakli/Desktop/irakli_linux -print | grep -i '.*[.]html'
Results:
/home/irakli/Desktop/irakli_linux/htmll/10.html
/home/irakli/Desktop/irakli_linux/htmll/11.html
/home/irakli/Desktop/irakli_linux/htmll/12.html
/home/irakli/Desktop/irakli_linux/htmll/13.html
/home/irakli/Desktop/irakli_linux/htmll/14.html
/home/irakli/Desktop/irakli_linux/htmll/15.html
I only want 1.html 2.html
...
command-line find
New contributor
This question already has an answer here:
How to Search for Files Recursively into Subdirectories
4 answers
How do you output the filename in find command while using -exec?
7 answers
I want to find all html
files and only show the file names, not the full file path, what I tried:
find /home/irakli/Desktop/irakli_linux -print | grep -i '.*[.]html'
Results:
/home/irakli/Desktop/irakli_linux/htmll/10.html
/home/irakli/Desktop/irakli_linux/htmll/11.html
/home/irakli/Desktop/irakli_linux/htmll/12.html
/home/irakli/Desktop/irakli_linux/htmll/13.html
/home/irakli/Desktop/irakli_linux/htmll/14.html
/home/irakli/Desktop/irakli_linux/htmll/15.html
I only want 1.html 2.html
...
This question already has an answer here:
How to Search for Files Recursively into Subdirectories
4 answers
How do you output the filename in find command while using -exec?
7 answers
command-line find
command-line find
New contributor
New contributor
edited Dec 30 '18 at 11:13
Ravexina
31.4k1481110
31.4k1481110
New contributor
asked Dec 30 '18 at 11:02
Irakli
31
31
New contributor
New contributor
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 11:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Sergiy Kolodyazhnyy
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Dec 30 '18 at 11:26
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
@Sergiy I doubt this is a duplicate of How to Search for Files Recursively into Subdirectories. This one particularly asks how to print just the filename (without the path) while the other one asks forfind
in general.
– PerlDuck
Dec 30 '18 at 11:56
@PerlDuck Admittedly, the many top answers don't mention printing only filename without path, however IMHO it's a matter of reading the manual and adding proper flag to the command. I have, however, edited my own answer there to mention some of the flagsfind
has, so hopefully that covers it. Alternatively, askubuntu.com/a/651321/295286 would probably be a more appropriate, and it pretty much same question in the title. Feel free to vote on reopening, though.
– Sergiy Kolodyazhnyy
Dec 30 '18 at 12:01
@SergiyKolodyazhnyy Congrats oncommand-line
gold :) This seems more of a duplicate for printing basename only?
– WinEunuuchs2Unix
Dec 30 '18 at 14:46
@WinEunuuchs2Unix Hi, thanks. I've hadcommand-line
gold for about 2-3 years now. Check the list of duplicates to this post - there's two, How do you output the filename in find command while using -exec? addresses that issue.
– Sergiy Kolodyazhnyy
Dec 30 '18 at 22:53
add a comment |
@Sergiy I doubt this is a duplicate of How to Search for Files Recursively into Subdirectories. This one particularly asks how to print just the filename (without the path) while the other one asks forfind
in general.
– PerlDuck
Dec 30 '18 at 11:56
@PerlDuck Admittedly, the many top answers don't mention printing only filename without path, however IMHO it's a matter of reading the manual and adding proper flag to the command. I have, however, edited my own answer there to mention some of the flagsfind
has, so hopefully that covers it. Alternatively, askubuntu.com/a/651321/295286 would probably be a more appropriate, and it pretty much same question in the title. Feel free to vote on reopening, though.
– Sergiy Kolodyazhnyy
Dec 30 '18 at 12:01
@SergiyKolodyazhnyy Congrats oncommand-line
gold :) This seems more of a duplicate for printing basename only?
– WinEunuuchs2Unix
Dec 30 '18 at 14:46
@WinEunuuchs2Unix Hi, thanks. I've hadcommand-line
gold for about 2-3 years now. Check the list of duplicates to this post - there's two, How do you output the filename in find command while using -exec? addresses that issue.
– Sergiy Kolodyazhnyy
Dec 30 '18 at 22:53
@Sergiy I doubt this is a duplicate of How to Search for Files Recursively into Subdirectories. This one particularly asks how to print just the filename (without the path) while the other one asks for
find
in general.– PerlDuck
Dec 30 '18 at 11:56
@Sergiy I doubt this is a duplicate of How to Search for Files Recursively into Subdirectories. This one particularly asks how to print just the filename (without the path) while the other one asks for
find
in general.– PerlDuck
Dec 30 '18 at 11:56
@PerlDuck Admittedly, the many top answers don't mention printing only filename without path, however IMHO it's a matter of reading the manual and adding proper flag to the command. I have, however, edited my own answer there to mention some of the flags
find
has, so hopefully that covers it. Alternatively, askubuntu.com/a/651321/295286 would probably be a more appropriate, and it pretty much same question in the title. Feel free to vote on reopening, though.– Sergiy Kolodyazhnyy
Dec 30 '18 at 12:01
@PerlDuck Admittedly, the many top answers don't mention printing only filename without path, however IMHO it's a matter of reading the manual and adding proper flag to the command. I have, however, edited my own answer there to mention some of the flags
find
has, so hopefully that covers it. Alternatively, askubuntu.com/a/651321/295286 would probably be a more appropriate, and it pretty much same question in the title. Feel free to vote on reopening, though.– Sergiy Kolodyazhnyy
Dec 30 '18 at 12:01
@SergiyKolodyazhnyy Congrats on
command-line
gold :) This seems more of a duplicate for printing basename only?– WinEunuuchs2Unix
Dec 30 '18 at 14:46
@SergiyKolodyazhnyy Congrats on
command-line
gold :) This seems more of a duplicate for printing basename only?– WinEunuuchs2Unix
Dec 30 '18 at 14:46
@WinEunuuchs2Unix Hi, thanks. I've had
command-line
gold for about 2-3 years now. Check the list of duplicates to this post - there's two, How do you output the filename in find command while using -exec? addresses that issue.– Sergiy Kolodyazhnyy
Dec 30 '18 at 22:53
@WinEunuuchs2Unix Hi, thanks. I've had
command-line
gold for about 2-3 years now. Check the list of duplicates to this post - there's two, How do you output the filename in find command while using -exec? addresses that issue.– Sergiy Kolodyazhnyy
Dec 30 '18 at 22:53
add a comment |
1 Answer
1
active
oldest
votes
There is no need to use grep
, find
can do exactly what you seek.
Use:
find -iname "*.html" -printf "%fn"
It will look for all html
files and only prints out their name.
If you want all names at the same line:
find -iname "*.html" -printf "%f "
It's works, can you please tell me what's is %fn?
– Irakli
Dec 30 '18 at 11:14
%f
file name,n
, a new line.
– Ravexina
Dec 30 '18 at 11:16
1
@Irakli See manpages.ubuntu.com/manpages/bionic/man1/find.1.html and scroll down to-printf
. There are various other %something flags you can use, e.g. %s for the file's size.
– PerlDuck
Dec 30 '18 at 11:19
"%fn"
maybe better in case some filenames have spaces in them.
– DK Bose
Dec 30 '18 at 11:22
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no need to use grep
, find
can do exactly what you seek.
Use:
find -iname "*.html" -printf "%fn"
It will look for all html
files and only prints out their name.
If you want all names at the same line:
find -iname "*.html" -printf "%f "
It's works, can you please tell me what's is %fn?
– Irakli
Dec 30 '18 at 11:14
%f
file name,n
, a new line.
– Ravexina
Dec 30 '18 at 11:16
1
@Irakli See manpages.ubuntu.com/manpages/bionic/man1/find.1.html and scroll down to-printf
. There are various other %something flags you can use, e.g. %s for the file's size.
– PerlDuck
Dec 30 '18 at 11:19
"%fn"
maybe better in case some filenames have spaces in them.
– DK Bose
Dec 30 '18 at 11:22
add a comment |
There is no need to use grep
, find
can do exactly what you seek.
Use:
find -iname "*.html" -printf "%fn"
It will look for all html
files and only prints out their name.
If you want all names at the same line:
find -iname "*.html" -printf "%f "
It's works, can you please tell me what's is %fn?
– Irakli
Dec 30 '18 at 11:14
%f
file name,n
, a new line.
– Ravexina
Dec 30 '18 at 11:16
1
@Irakli See manpages.ubuntu.com/manpages/bionic/man1/find.1.html and scroll down to-printf
. There are various other %something flags you can use, e.g. %s for the file's size.
– PerlDuck
Dec 30 '18 at 11:19
"%fn"
maybe better in case some filenames have spaces in them.
– DK Bose
Dec 30 '18 at 11:22
add a comment |
There is no need to use grep
, find
can do exactly what you seek.
Use:
find -iname "*.html" -printf "%fn"
It will look for all html
files and only prints out their name.
If you want all names at the same line:
find -iname "*.html" -printf "%f "
There is no need to use grep
, find
can do exactly what you seek.
Use:
find -iname "*.html" -printf "%fn"
It will look for all html
files and only prints out their name.
If you want all names at the same line:
find -iname "*.html" -printf "%f "
edited Dec 30 '18 at 11:16
answered Dec 30 '18 at 11:11
Ravexina
31.4k1481110
31.4k1481110
It's works, can you please tell me what's is %fn?
– Irakli
Dec 30 '18 at 11:14
%f
file name,n
, a new line.
– Ravexina
Dec 30 '18 at 11:16
1
@Irakli See manpages.ubuntu.com/manpages/bionic/man1/find.1.html and scroll down to-printf
. There are various other %something flags you can use, e.g. %s for the file's size.
– PerlDuck
Dec 30 '18 at 11:19
"%fn"
maybe better in case some filenames have spaces in them.
– DK Bose
Dec 30 '18 at 11:22
add a comment |
It's works, can you please tell me what's is %fn?
– Irakli
Dec 30 '18 at 11:14
%f
file name,n
, a new line.
– Ravexina
Dec 30 '18 at 11:16
1
@Irakli See manpages.ubuntu.com/manpages/bionic/man1/find.1.html and scroll down to-printf
. There are various other %something flags you can use, e.g. %s for the file's size.
– PerlDuck
Dec 30 '18 at 11:19
"%fn"
maybe better in case some filenames have spaces in them.
– DK Bose
Dec 30 '18 at 11:22
It's works, can you please tell me what's is %fn?
– Irakli
Dec 30 '18 at 11:14
It's works, can you please tell me what's is %fn?
– Irakli
Dec 30 '18 at 11:14
%f
file name, n
, a new line.– Ravexina
Dec 30 '18 at 11:16
%f
file name, n
, a new line.– Ravexina
Dec 30 '18 at 11:16
1
1
@Irakli See manpages.ubuntu.com/manpages/bionic/man1/find.1.html and scroll down to
-printf
. There are various other %something flags you can use, e.g. %s for the file's size.– PerlDuck
Dec 30 '18 at 11:19
@Irakli See manpages.ubuntu.com/manpages/bionic/man1/find.1.html and scroll down to
-printf
. There are various other %something flags you can use, e.g. %s for the file's size.– PerlDuck
Dec 30 '18 at 11:19
"%fn"
maybe better in case some filenames have spaces in them.– DK Bose
Dec 30 '18 at 11:22
"%fn"
maybe better in case some filenames have spaces in them.– DK Bose
Dec 30 '18 at 11:22
add a comment |
@Sergiy I doubt this is a duplicate of How to Search for Files Recursively into Subdirectories. This one particularly asks how to print just the filename (without the path) while the other one asks for
find
in general.– PerlDuck
Dec 30 '18 at 11:56
@PerlDuck Admittedly, the many top answers don't mention printing only filename without path, however IMHO it's a matter of reading the manual and adding proper flag to the command. I have, however, edited my own answer there to mention some of the flags
find
has, so hopefully that covers it. Alternatively, askubuntu.com/a/651321/295286 would probably be a more appropriate, and it pretty much same question in the title. Feel free to vote on reopening, though.– Sergiy Kolodyazhnyy
Dec 30 '18 at 12:01
@SergiyKolodyazhnyy Congrats on
command-line
gold :) This seems more of a duplicate for printing basename only?– WinEunuuchs2Unix
Dec 30 '18 at 14:46
@WinEunuuchs2Unix Hi, thanks. I've had
command-line
gold for about 2-3 years now. Check the list of duplicates to this post - there's two, How do you output the filename in find command while using -exec? addresses that issue.– Sergiy Kolodyazhnyy
Dec 30 '18 at 22:53