From 52f227c403a9a917c1587c9a1ff5ed77ce2e131a Mon Sep 17 00:00:00 2001
From: Alderico Gallo <20024636@studenti.uniupo.it>
Date: Thu, 1 Sep 2022 17:27:20 +0200
Subject: [PATCH] Find only list regular files

---
 src/main.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 86dea53..0a4b544 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -84,13 +84,13 @@ int print_dir_recursive(char *arguments[], bool recursive)
 		for (std::filesystem::recursive_directory_iterator i(path), end; i != end; ++i)
 			if (is_directory(i->path()))
 				std::cout << i->path().generic_string() << "/\n";
-			else
+			else if (is_regular_file(i->path()))
 				std::cout << i->path().generic_string() << "\n";
 	} else {
 		for (std::filesystem::directory_iterator i(path), end; i != end; ++i)
 			if (is_directory(i->path()))
 				std::cout << i->path().generic_string() << "/\n";
-			else
+			else if (is_regular_file(i->path()))
 				std::cout << i->path().generic_string() << "\n";
 	}
 
-- 
GitLab