Skip to content
Advertisement

list only directory if contain a specific file name in bash

Hel lo everyone, I need help with bash commands.

Here is the deal :

I have several directories :

such as

JavaScript

and a /path_to_this_file/file.txt :

JavaScript

that I use such as :

JavaScript

then I can list all content in the paths BUT I would like to do a ls only for the path2 that does not have a file2 into their directory..

Here only the path1/B/path2/ should be listed

Does someone have a code for that ?

Advertisement

Answer

Added an if statement to your code:

JavaScript

Alternatively:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement