我希望我的程序遍历Windows系统上的所有驱动器并搜索特定的文件类型.现在,我可以运行程序并将驱动器号传递给它,但我希望它能自动搜索所有驱动器.目前,我需要做这样的事情:
C:\> program.exe C:
C:\> program.exe D:
C:\> program.exe E:
Run Code Online (Sandbox Code Playgroud)
我希望程序获取所有驱动器的列表并遍历所有驱动器,而无需用户指定驱动器号.这可能使用Go吗?
与此问题类似,列出所有物理驱动器(Windows)但使用Go而不是C.
我正在寻找所有setuid/setgid文件.当我不使用时-exec,它按预期工作:
# find /usr/bin -type f -perm -4000 -o -perm -2000
/usr/bin/wall
/usr/bin/ksu
/usr/bin/chage
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/fusermount
/usr/bin/passwd
/usr/bin/write
/usr/bin/su
/usr/bin/umount
/usr/bin/gpasswd
/usr/bin/newgrp
/usr/bin/mount
/usr/bin/pkexec
/usr/bin/crontab
/usr/bin/cgclassify
/usr/bin/cgexec
/usr/bin/ssh-agent
/usr/bin/Xorg
/usr/bin/at
/usr/bin/sudo
/usr/bin/locate
/usr/bin/staprun
Run Code Online (Sandbox Code Playgroud)
当我使用时-exec,我只得到一部分结果:
# find /usr/bin -type f -perm -4000 -o -perm -2000 -exec ls -l {} \;
-r-xr-sr-x. 1 root tty 15344 Jan 27 2014 /usr/bin/wall
-rwxr-sr-x. 1 root tty 19536 Aug 21 2015 /usr/bin/write
-rwxr-sr-x. 1 root cgred 15624 Sep 21 2014 …Run Code Online (Sandbox Code Playgroud)