[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] Omdøbning af mange filer



"Jens Bang" <sslug@sslug> writes:

>> "Jens Bang" <sslug@sslug> writes:
>>
>>> Jeg prøvede denne kommando på et subset. Og den renamer ikek noget. :-)
>>>
>>> find -depth -name . -execdir prename 's/["<>?*:]/_/g' {} +
>>
>> Hvad tror du -name gør?
>
> Finder filerne. Jeg indsatte den fordi det ikke virkede uden:

Den finder netop de filer der hedder '.'. 

Det er ret uinteressant, for find vil højst finde en fil med det navn og
den vil ikke blive omdøbt af rename-komandoen. (Det ville også være
noget rod, for filen ved navn '.' er speciel i unix)

Istedet for bare at kaste tilfældige muligheder efter find som du måske
har set i brug før, så må du lave lidt målrettet fejlsøgning. Først og
fremmest kunen det være interessant at se om det er find eller renmae
der går galt.

Prøv find-kommandoen uden at udføre rename kommandoen. Det vil sige
enten 

$ find -depth 

eller 

$ find -depth -execdir echo {} +

Det skulle giver dig en ide om at find i hvert fald finder de filer du
forventer.

Dernæst kan du tjekke om rename virker ved at udelade
find-kommandoen. Det vil sige tag et par filer i hånden du ved skal
omdøbes:

$ rename 's/["<>?*:]/_/g' './path/to/<file>.txt' './Codename: test/success?.txt'

eller hvad dine filer nu hedder. 

//Makholm


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2012-07-01, 02:01 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] *