Como eu crio um link para todos os executáveis em um diretório diferente?

2

Estou tentando criar links para os binários do mingw no cygwin.

Até agora eu tenho: find /cygdrive/c/MinGW/bin/ -name "*.exe" -exec ln -s {} basename {} \;

mas eu recebo:

ln: target '/cygdrive/c/MinGW/bin/addr2line.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/ar.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/as.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/c++.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/c++filt.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/cc.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/cpp.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/dlltool.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/dllwrap.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/elfedit.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/envsubst.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/g++.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/gcc.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/gcov.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/gdb.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/gdbserver.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/gettext.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/gprof.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/iconv.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/ld.bfd.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/ld.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw-get.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw32-c++.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw32-cc.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw32-g++-4.6.2.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw32-g++.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw32-gcc-4.6.2.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw32-gcc.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/mingw32-make.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgattrib.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgcat.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgcmp.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgcomm.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgconv.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgen.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgexec.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgfilter.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgfmt.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msggrep.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msginit.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgmerge.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msgunfmt.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/msguniq.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/ngettext.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/nm.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/objcopy.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/objdump.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/pkginfo.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/quserex-test.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/ranlib.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/readelf.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/recode-sr-latin.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/size.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/strings.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/strip.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/windmc.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/windres.exe' is not a directory
ln: target '/cygdrive/c/MinGW/bin/xgettext.exe' is not a directory
    
por chacham15 17.07.2012 / 00:43

3 respostas

3

Para fazer seu comando funcionar, não acho que você possa evitar o sub-descasque, algo como:

find /cygdrive/c/MinGW/bin/ -name "*.exe" -print0 | xargs -0 -n1 bash -c 'ln -s {} $(basename {})'

Se todos os arquivos estiverem no mesmo diretório, você também pode usar cp -s :

cp -s /cygdrive/c/MinGW/bin/* .
    
por 17.07.2012 / 01:48
3

Como ln aceita diretórios como destinos:

ln -s /cygdrive/c/MinGW/bin/*.exe /path/to/otherdirectory/
    
por 17.07.2012 / 23:21
2
for i in /source/directory/*.exe; do
    ln -s $i /destination/directory/'basename $i'
done
    
por 17.07.2012 / 00:47