Re: [go-nuts] Search for directory named BigZoom and list contents.

2021-05-10 Thread Kurtis Rader
Hint #1: Note that fs.DirEntry.Name() only contains the final component of the path: https://golang.org/pkg/io/fs/#DirEntry. Hint #2: Note that fs.WalkDirFunc()'s first argument is the full path to the directory entry: https://golang.org/pkg/io/fs/#WalkDirFunc. See the example for the older fs.Wal

Re: [go-nuts] Search for directory named BigZoom and list contents.

2021-05-10 Thread Adam
Hi Kurt - many thanks. I got it - I switched it to pass in the var 'p' instead of info.Name() and it works. Adam On Mon, 10 May 2021 at 04:19, Kurtis Rader wrote: > Hint #1: Note that fs.DirEntry.Name() only contains the final component > of the path: https://golang.org/pkg/io/fs/#DirEntry. > >

Re: [go-nuts] Search for directory named BigZoom and list contents.

2021-05-10 Thread Martin Schnabel
hi Adam, you call ReadDir with the file name and not with the full path or the path relative to your current working directory. that means you will try to read the dir with path "BigZoom" two times. the WalkDirFunc passes a path argument that concatenates the path prefix with the dir entry nam

[go-nuts] Search for directory named BigZoom and list contents.

2021-05-09 Thread Adam C
I'm trying to come up with a fairly small script to find a directory and then list the contents of a given directory name. The filestructure is thus: /root/1/1 /root/1/2 /root/1/BigZoom /root/1/BigZoom/1 /root/2/1 /root/2/2 /root/2/BigZoom /root/2/BigZoom/1 I want to find any file in a directo