Tuesday, January 20, 2015

Re: [LINUX_Newbies] Help with script and regex.

 

On 20Jan2015 22:14, Emil Payne <ehspayne@yahoo.com> wrote:
>On 20/01/15 08:05 PM, Cameron Simpson cs@zip.com.au [LINUX_Newbies] wrote:
[...]
>>or, given the regularity of your filenames:
>>
>>frename
>>'s/^(\d\d)«{(\d\d)}«{\d\d«{(\d\d\d\d).*/Pictures«Photos«$3-$1-$2/' *
>>
>>Just an idea.
>>
>>But FIRST, as a suggestion, take a copy of your tree (as almost zero
>>cost!)
>>Of all your folders are in some superfolder called "foo" (for >>example), go
>>to above the superfolder and say:
>>
>>cp -arl foo foo-NOT-RENAMED
>>
>Ok, I used the following in my Pictures folder:
>
>cp -arl * ../Temporary/DONE

Hmm. I had kind of suggested being higher up and going:

cp -arl Pictures Temporary/Pictures-not-renamed

>Now, from what little I see, this works on files and not folders ???

What's "this"?

The rename commands will rename files or directories, whatever you point it at.

BTW, in the frename example about, the { and } chars _will_ need escaping. Not
because they are special to the shell but because they are special to regular
expressions.

And of course test the suggestions carefully: they are untested.

Cheers,
Cameron Simpson <cs@zip.com.au>

A pessimist is an optimist in full possession of the facts.

__._,_.___

Posted by: Cameron Simpson <cs@zip.com.au>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (15)
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.

.

__,_._,___

No comments:

Post a Comment