我有以下计划:
public class Program
{
public void Main(string[] args)
{
var dir = args[0];
foreach (var file in Directory.GetDirectories(dir))
Console.WriteLine(file);
}
}
我把它放在一个docker容器中并在这样的debian机器上执行它;
docker run test /lib
结果:
/lib/firmware
/lib/hdparm
/lib/init
/lib/lsb
/lib/modprobe.d
/lib/systemd
/lib/terminfo
/lib/udev
/lib/x86_64-linux-gnu
然而,这不是/lib
中的所有目录。我认为存在权限问题阻止某些条目无法显示,但运行ls -pl | grep '/'
会导致以下结果:
lrwxrwxrwx 1 root root 21 Feb 2 2014 cpp -> /etc/alternatives/cpp
drwxr-xr-x 2 root root 4096 Sep 12 13:35 discover/
drwxr-xr-x 11 root root 4096 Sep 12 14:49 firmware/
drwxr-xr-x 2 root root 4096 Sep 12 13:35 hdparm/
drwxr-xr-x 2 root root 4096 Sep 12 13:34 ifupdown/
drwxr-xr-x 2 root root 4096 Sep 12 14:47 init/
drwxr-xr-x 3 root root 4096 Sep 12 13:33 lsb/
drwxr-xr-x 2 root root 4096 Sep 12 13:33 modprobe.d/
drwxr-xr-x 5 root root 4096 Sep 12 13:49 modules/
drwxr-xr-x 2 root root 4096 Sep 12 13:34 modules-load.d/
drwxr-xr-x 2 root root 4096 Sep 12 13:46 startpar/
drwxr-xr-x 8 root root 4096 Sep 12 13:47 systemd/
drwxr-xr-x 2 root root 4096 Sep 12 13:47 sysvinit/
drwxr-xr-x 15 root root 4096 Feb 1 2014 terminfo/
drwxr-xr-x 4 root root 4096 Sep 12 13:50 udev/
drwxr-xr-x 3 root root 12288 Sep 18 22:07 x86_64-linux-gnu/
drwxr-xr-x 2 root root 20480 Sep 12 13:49 xtables/
如何让原始程序列出ls
之类的所有目录?是否有另一个命令用于确定显示的目录与不显示的目录之间的区别?
DockerFile
FROM microsoft/aspnet:1.0.0-beta7
ADD . /app
WORKDIR /app
ENTRYPOINT ["./ConsoleTest"]