On the assumption that you know the name of the file that you want to rename then you should be able to get the name into an R:Base variable.

If you have the filename and extension then you split the name into its two components.(SLOC the full stop then SGET either side of it. OR SRPL the full stop with a comma and SSUB the two components. There must be other ways as well...) If you only have the name in R:Base without the extension then, presumably, you know what the extensions you want to use are.

Therefore:

You can thus obtain three variables - vFileName, vCurrExt, vNewExt. Create a fourth:

SET VAR vReName = ('RENAME' & ' " ' + .vFileName + '.' + .vCurrExt + ' " ' & ' " ' + .vFileName + '.' + .vNewExt + ' " ')

NB: I've put spaces either side of the double quotes to try and indicate that they are double quotes inside single quotes. Windows often seems to like double quotes these days when using DOS file commands... The mail system will probably mess it up so copy and paste it somewhere you can make one line out of it! I've not put any continuation + signs in.
That translates to, for example:

RENAME "FileName.CUR" "FileName.NEW"

which is the filenames with double quotes around them.

Then use:

&vReName

to do the renaming.

Remember, too, if you have the path name as well NOT to include it in the new name!

Regards,
Alastair.


----- Original Message ----- From: "Paul InterlockInfo" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, September 28, 2009 5:07 PM
Subject: [RBASE-L] - RE: Using Wild Card ??????


I need a bit of help here and it is driving me crazy. I have a routine that
renames a file from 4632321214_0908221430.txt and I want it to change to
4632321214_0908221430.ftp

1. These file name could be 10 to 40 char long
2. I have NO control over the names (please do not ask me to change them)


I thought I had it covered and then 5 out of 60 would not accept the change.
I used the following:
RENAME ????????????????????????????????????????.txt
????????????????????????????????????????.ftp  (yes that is forty ??'s on
both sides)



Example of a name that would not change:  104745_0909221430.log


I have a lot longer and shorter that did change names,  all attributes are
"A"   all local or network same results.  Does not change from OS.  No
difference between 7.6 or later, compiled or not. I suppose you could say, "No green eggs or ham" trying to find humor! I have had this issue now for three weeks and review a lot of old email trying to find my error. I do not
want to store a command (.cmd shell batch) and zip out or launch.  I would
like this to stay internal, but I am also running out of options.

Any thoughts?




Sincerely,
Paul Dewey




--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.113/2400 - Release Date: 09/28/09 05:51:00


Reply via email to