2013-04-30 22 views

risposta

49

Controllare il nuovo man page;) E ':

find /path/to/files -type f 

type f ricerche dei file regolari solo - escludendo i collegamenti simbolici.

+1

ah ah, sì ok, ho pensato che normale file inclusi link simbolici. Mi dispiace per quello Bene otterrete dei punti per una facile domanda :) – Barth

+0

ora lo sapete .. :) – hek2mgl

+1

qui corrisponde a symlink che puntano a file regolari, ho dovuto usare '-tipo f -xtype f' –

1

Vuoi seguire i collegamenti simbolici ma non restituirli (se corrispondono al tuo modello)?

find -H?

man find 
    ... 
    -H  Cause the file information and file type (see stat(2)) returned for each symbolic link specified on the command line to be those of 
      the file referenced by the link, not the link itself. If the referenced file does not exist, the file information and type will be 
      for the link itself. File information of all symbolic links not on the command line is that of the link itself. 

    -L  Cause the file information and file type (see stat(2)) returned for each symbolic link to be those of the file referenced by the 
      link, not the link itself. If the referenced file does not exist, the file information and type will be for the link itself. 

      This option is equivalent to the deprecated -follow primary. 
9
! -type l 

Per esempio, se si desidera cercare tutti i file regolari in/usr/bin, esclusi i link simbolico:

find /usr/bin/ \! -type l 
+0

No-tipo l cercherà SOLO PER collegamenti simbolici. Pagina di man checkout – laserbeamer

+1

Test di negazione con "!" (pling) - che dovrebbe essere sfuggito se necessario - restituirà tutto ciò che NON è un link simbolico. – MikeW

0

ho readed MAN e ora sembra è -P inoltre, usando -type r si genera un errore. anche notare è il comportamento DEFAULT ora.

-P Non seguire mai collegamenti simbolici. Questo è il comportamento predefinito predefinito. Quando trova esamina o stampa un file con le informazioni e il file è un collegamento simbolico, le informazioni utilizzate devono essere prese da le proprietà del collegamento simbolico stesso.

+1

Sì, ma l'OP non vuole alcun risultato derivante dal collegamento simbolico - presumo di evitare un'elaborazione doppia, dal momento che il "find" restituirà probabilmente sia il file "reale" che quello indirizzato dal link simbolico allo stesso file "reale". – MikeW

0

questo funziona per me:

ritrovamento -H. -maxdepth 1 -type f

In realtà, in realtà non ha bisogno del -H

Problemi correlati