You are not logged in.

#1 2019-05-02 12:21:50

MrFlacko
Member
Registered: 2019-01-08
Posts: 21

[SOLVED] List files recursively within directories that aren't hidden

I'm trying to find a command that will list all files in a directory (and sub directories) as long as the directories aren't hidden (so directories that don't start with a .)

I'm trying to make a script that will sort all files in my computer, all '.txt' files in a folder called 'txt' etc. but i don't want it to access the files that start with a .

This is what i have so far as a command

x=$(find * -type d | grep -v '\.' | sed 's/\ /\\ /g' | sed 's/(/\\(/' | sed 's/)/\\)/' | sed 's/$/\ \n/') && ls $x
this works but there are issues with files that have ' ' within them, i've tried some other things but i feel like there is a much better way to do this


to sum up i just want a command that will list all files recursively within directories that aren't hidden

SOLUTION:
ls -R

-_-

Last edited by MrFlacko (2019-05-02 12:53:18)

Offline

#2 2019-05-02 12:39:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,516

Re: [SOLVED] List files recursively within directories that aren't hidden

"ls -R"?

Offline

#3 2019-05-02 12:49:40

MrFlacko
Member
Registered: 2019-01-08
Posts: 21

Re: [SOLVED] List files recursively within directories that aren't hidden

seth wrote:

"ls -R"?

I want to do that bot only to folders that don't start with a '.'

EDIT
FFS I CAN'T BELIEVE I OVERLOOKED THAT

i'll close this post

Last edited by MrFlacko (2019-05-02 12:51:10)

Offline

#4 2019-05-02 12:50:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,516

Re: [SOLVED] List files recursively within directories that aren't hidden

-R should™ ignore hidden directories,

type ls

Offline

Board footer

Powered by FluxBB