[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [TEKNIK] Argument list too long



On 2006-03-01, Michael Schmidt <sslug@sslug> wrote:
> Jeg er, i forbindelse men håndtering af ca. 50.000 små filer, nu flere  
> gange blevet mødt med:
>
> Argument list too long

Det er bash der ikke kan håndtere så meget. 

>
> Da det har været med både cp, mv og ls i forbindelse med jokertegn og at  
> ls sagtens kunne liste alle filerne uden filter-mønster, mistænker jeg at  

'ls' tager bare og printer indholdet af en mappe ud.
hvis man derimod laver en 'ls *' så expanderer bash stjernen og lister
alle tingene op på samme linje som argumenter til ls og det kan bash så
ikke håndtere.

En meget brugt løsning er 
'ls | xargs rm -rf' hvor man lader xargs splitte det ud i passende
bidder i stedet for 'rm -rf *' hvor det er bash der gør noget.
eller blot 'ls | while read line; do rm -rf $line; done'
Find kan også tricks.
'find . -exec rm -rf {}'

OBS! Selvom dette er [TEKNIK] så må jeg hellere lig efortælle at alle de
kommandoer jeg har nævn rekursivt sletter indholdet i den mappe man står
i.



/Sune


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-04-01, 02:02 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *