Page 1 of 1

Use PATTERN that contains spaces in name

PostPosted: Thu Aug 02, 2012 7:53 am
by WillyK
Maybe an easy one but,

I want to use a PATTERN that contains and use spaces,

example; /PATTERN:"This is a example"
it may only find this complete string (spaces included) and not the one that contains only "this" or "is" or "a" or "example"

(The /PATTERN will be a variable coming from Total Commander)

Hoping for a answer,

Regards,

Willy

Re: Use PATTERN that contains spaces in name

PostPosted: Thu Aug 02, 2012 9:10 am
by Stefan
What exactly is your problem?
What do you do?
What does not work?

I think
/PATTERN:"This is a example"
will already do? Isn't it?



.

Re: Use PATTERN that contains spaces in name

PostPosted: Thu Aug 02, 2012 10:18 am
by WillyK
Thanks for the response,

Using: BRC64.exe v1.3.3.0

I want to add suffix or sometimes rename directories or other things, but when I use a pattern that contains spaces it won't take this as a argument, my command line will do the things I will if there are no spaces in the pattern.

Examples:

I've got 2 folders, folder with name '01' and another with name '02 22'
I use:

brc64.exe /DIR:"d:\DIR\" /PATTERN:"01" /NOFILES /SUFFIX:" A" /EXECUTE

This works and adds the suffix ' A' > Folder name changed from '01' to '01 A"

But when I want to change folder '02 22'

brc64.exe /DIR:"d:\DIR\" /PATTERN:"01 22" /NOFILES /SUFFIX:" 2" /EXECUTE

It doesn't work, it had to be > Folder name had to be changed from '01 22' to '01 22 A'

(The individual folders '01' or '22' if they exist must not be renamed so I use a compete pattern, included with spaces in the name if there are any.)

For /PATTERN; it works every time if the /PATTERN: argument doesn't contain any spaces and the argument is one word.

Br,
Willy

Re: Use PATTERN that contains spaces in name

PostPosted: Thu Aug 02, 2012 4:45 pm
by Stefan
Try

/PATTERN:"This*is*a*example"
instead of
/PATTERN:"This is a example"

In your case:
/PATTERN:"01*22"


- - -


It seams for me anyway, only matching the whole name will work:

/PATTERN:"This*is*a*example"
or
/PATTERN:"*is*"

/PATTERN:"*01"
/PATTERN:"*01*22"

and so your example will not work anyway:
brc64.exe /DIR:"d:\DIR\" /PATTERN:"01" /NOFILES /SUFFIX:" A" /EXECUTE

Re: Use PATTERN that contains spaces in name

PostPosted: Thu Aug 02, 2012 5:04 pm
by WillyK
Stefan,

Than it won't work for me, because the parameter comes from a variable from Total Commander and contains spaces in the name and I don't see a way to change these spaces to asterisks to get it in the pattern parameter.

Still thanks,

Br,
Willy

Re: Use PATTERN that contains spaces in name

PostPosted: Thu Aug 02, 2012 7:08 pm
by Stefan
WillyK wrote:Stefan,

Than it won't work for me, because the parameter comes from a variable from Total Commander and contains spaces in the name and I don't see a way to change these spaces to asterisks to get it in the pattern parameter.

Still thanks,

Br,
Willy


Then don't call BRC from TC but an batch which will do the needed modification:


Code: Select all
@ECHO OFF
REM // the input:
SET PAT=%1
SET Pat=This is a example
SET Pat=This_is a-example

REM // replace space to star:
SET PAT=%PAT: =*%

REM // Execute BRC:
SET BRC64=X:\Tools\Ren\BRC\brc64
ECHO %BRC64% /DIR:"d:\DIR\" /PATTERN:"%PAT%" /NOFILES /SUFFIX:" 2" /EXECUTE

PAUSE

Re: Use PATTERN that contains spaces in name

PostPosted: Fri Aug 03, 2012 12:35 pm
by WillyK
Ok, I'll try and experiment with the script, thanks Stefan.

Br,
Willy