Not to harp an old tune, but this is an example of why I encourage everyone to 
pick up on at least some rudimentary skill level using vbscript / jscript.

This scenario is faced by IT personnel everyday and sometimes the scope of the 
problem can be larger than Chucks.  Using the FileSystemObject and Regular 
Expressions, the rename of a group of files would be accomplished in probably 
twenty or so lines of code..

Some of you were probably very adept DOS batch file users.  Scripting grew out 
of the shortcomings / limitations of that environment and is quite powerful 
(you can write a pretty sophisticated application in scripting if you really 
wanted to do it) and using the RScripter plugin, these scripts can be 
incorporated seamlessly into the RBase environment....

----- Original Message ----- 
From: "David M. Blocker" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[email protected]>
Sent: Wednesday, June 29, 2005 8:39 AM
Subject: [RBG7-L] - Re: Locating files in a directory


> Chuck
>
> You could load the files into an R:Base table with two columns, OldFileName,
> NewFileName
>
> Copy OldFileName into NewFileName
>
> Edit the ones you need to rename - I bet you could use the SRPL function to
> do it in quick steps
>
> Write a short cursor routine WHERE OldFileName <> NewFileName
>
> The routine RENAMES OldFileName NewFileName.
>
> David
>
> David Blocker
> [EMAIL PROTECTED]
> 781-784-1919
> Fax: 781-784-1860
> Cell: 339-206-0261
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: "RBG7-L Mailing List" <[email protected]>
> Sent: Wednesday, June 29, 2005 6:02 AM
> Subject: [RBG7-L] - Re: Locating files in a directory
>
>
>> First, again thanks for your help.
>> I have learned some additions insights into trying to select files from a
>> directory.
>> First - don't use commas
>> Second - no periods other the file ending (.mp3)
>> I am not sure about other characters such - ( ) etc.
>> The char(39) works very well in putting the quotes around the name.
>> Does anyone know of a good directory editor that would permit me to
> replace
>> commas and periods. I have over 2000 files
>> In the cd directory.
>> Just has to be an easier way to change it.
>> Thanks again.
>> Chuck Conrad
>>
>>
>> -----Original Message-----
>> From: James Bentley [mailto:[EMAIL PROTECTED]
>> Sent: Monday, 27 June, 2005 01:39
>> To: RBG7-L Mailing List
>> Subject: [RBG7-L] - Re: Locating files in a directory
>>
>> Chuck,
>>
>> Please note that you have an extra space between the quote character and
> the
>> equal sign when you reset the QUOTES character after setting it to
>> doublequote:
>> >   set quotes ="
>> >   set var voldname = ("'"+.vfilename+"'")
>> >   set quotes = '
>> instead try replacing the above three lines with
>>     set var voldname = (CHAR(39)+.vfilename+CHAR(39)) thus you don't haove
>> to set and reset the quotes char
>>
>> Jim Bentley
>> American Celiac Sodiety
>> [EMAIL PROTECTED]
>> --- Sami Aaron <[EMAIL PROTECTED]> wrote:
>>
>> > Chuck -
>> >
>> > Use the following example to get the short file name and copy the file
>> > using that instead of the long file name.
>> >
>> > --  SELECT FILEname1 INTO VFILENAME FROM FILINFO WHERE FILENAME1  CONT
>> > .VCNT SET V vfilename = +
>> >   '0000080 Bach Concerto No. 6 for Harpischord, 2 Recorders, Strings,
>> > and Continuo in  F Major, BWV 1057.MP3'
>> >
>> > SET ERROR MESSAGES 2038 OFF
>> > DROP TAB folderlist
>> > SET ERROR MESSAGES 2038 ON
>> >
>> > CREATE TEMP TABLE `FolderList`   (`file_name` TEXT
>> >  (8) ,   `FileExt` +
>> >  TEXT    (3) ,   `FileBytes` TEXT    (10) ,
>> > `FileDate` +
>> >  DATE     ,   `FileTime` TIME     ,   `FileextTxt`=
>> > (CTXT(fileext)) +
>> >  TEXT    (3) ,   `FileName_Ext`=
>> > (File_Name+'.'+FileExtTxt) +
>> >  TEXT    (12), `FileLongName` TEXT (200) )
>> >
>> > --Set up the file extensions you want in your list SET V vfullfile =
>> > ('*.mp3') SET V vfullfile2 = ((CHAR(39)) + .vfullfile +
>> > (CHAR(39)))
>> >
>> > --Get a unique file name for the temporary file SET V vfiledir =
>> > (FILENAME(0)) OUTPUT .vfiledir DIR &vfullfile2 OUTPUT SCREEN
>> >
>> > LOAD FolderList FROM .vfiledir +
>> >  AS FORMATTED USING File_Name 1 8,FileExt 10 12,FileBytes 14 23,+
>> > FileDate 26 33, FileTime 36 41,FileLongName 43 242
>> >
>> > SET VAr vShortOldName TEXT = NULL
>> > SELECT FileName_Ext INTO vShortOldName FROM FolderList +  WHERE
>> > FileLongName = .vFileName
>> >
>> > SET V vloc = 'Morning\'
>> > SET VAR vnewname = (SGET(.vFileName,7,1)) SET VAR vnewname1 =
>> > (.vnewname + '.mp3') SET VAR vloc4 = (.vloc + .vnewname1) COPY
>> > &vShortOldName &vloc4
>> >
>> > Good luck with your presentation Monday!
>> > Sami
>> >
>> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> > Sami Aaron
>> > Software Management Specialists
>> > 913-915-1971
>> > [EMAIL PROTECTED]
>> >
>> >
>> >
>> > ________________________________
>> >
>> > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of
>> > [EMAIL PROTECTED]
>> > Sent: Saturday, June 25, 2005 7:08 PM
>> > To: RBG7-L Mailing List
>> > Subject: [RBG7-L] - Re: Locating files in a directory
>> >
>> >
>> > My objective is to copy a mp3 file from the
>> > c:\Musc\CDs directory to E:\
>> > 28June2005\Morning directory.  The file gets renamed
>> > in the process for
>> > example 08-000080.mp3 from the original 0000080 Bach
>> > Concerto No. 6 for
>> > Harpischord, 2 Recorders, Strings, and Continuo in
>> > F Major, BWV 1057.MP3.
>> > I have copy text files to a table in my database
>> > which is exactly the same
>> > as the directory infornation. However, the program
>> > will not always select
>> > the file for transfer.
>> > Below is the code I am using.
>> > SET VAR vdate1 = (getdate('Select Date'))
>> > CHOOSE vwant FROM #LIST '1MP,2EP' AT
>> > CENTER,CENTER,TITLE 'Program Selection'
>> > SET VAR vloc1 = ('E:\CNJ\')
>> > IF vwant = '1MP' THEN
>> >   SET VAR vloc3 = '\Morning\'
>> > ELSE
>> >   SET VAR vloc3 = '\Evening\'
>> > ENDIF
>> > DIALOG 'Enter Directory for Program (XX Month YYYY)'
>> > vloc2=20 v1 1 AT
>> > CENTER,CENTER
>> > SET VAR vloc = (.vloc1+.vloc2+.vloc3)
>> > WHENEVER NOT FOUND GOTO errors
>> > DROP CURSOR cur1
>> > DECLARE cur1 CURSOR FOR SELECT selno, cntrl FROM
>> > music WHERE program =
>> > .vwant +
>> >    AND playdate1 = .vdate1 AND selno EXISTS AND
>> > CNTRL EXISTS ORDER BY selno
>> > OPEN cur1
>> > FETCH cur1 INTO vsel INDV1, vcnt
>> > WHILE SQLCODE = 0 THEN
>> >   iF vsel < 10 THEN
>> >      IF SELNO < 6 THEN
>> >         GOTO ENDSECT
>> >      ENDIF
>> >     SET VAR vseltext = ('0'+(CTXT(.vsel)) + '-')
>> >   ELSE
>> >     SET VAR vseltext = ((CTXT(.vsel)) +'-')
>> >   ENDIF
>> >   SET VAR vnum TEXT = (CTXT(.vcnt))
>> >   SELECT FILEname1 INTO VFILENAME FROM FILINFO
>> > WHERE FILENAME1  CONT .VCNT
>> >   set quotes ="
>> >   set var voldname = ("'"+.vfilename+"'")
>> >   set quotes = '
>> >   SET VAR VNEWNAME = (SGET(.VFILENAME,7,1))
>> >   set var vnewname1 = (.vseltext + .vnewname +
>> > '.mp3')
>> >   SET VAR vloc4 = (.vloc + .vnewname1)
>> >   cd cds
>> >   COPY &voldname &vloc4
>> >   cd ..
>> >   LABEL ENDSECT
>> >   FETCH cur1 INTO vsel INDV1,vcnt
>> > ENDWHILE
>> >
>> > Appreciate your input.
>> > Chuck
>> >
>> > ________________________________
>> >
>> > From: Bernard Lis [mailto:[EMAIL PROTECTED]
>> > Sent: Sunday, 26 June, 2005 06:58
>> > To: RBG7-L Mailing List
>> > Subject: [RBG7-L] - Re: Locating files in a
>> > directory
>> >
>> >
>> > Chuck,
>> > I'm not exactly clear about your final goal but, you
>> > could
>> > after selecting the id (000080), unload the data
>> > into an ascii file
>> > copy the file to the receiving directory and then
>> > .........
>> > Here I am lost! do you want to input it into another
>> > database or what will
>> > you do with it after copying it?
>> >
>> > Bernie Lis
>> >
>> > ----- Original Message -----
>> > From: [EMAIL PROTECTED]
>> > To: RBG7-L Mailing List <mailto:[email protected]>
>> > Sent: Saturday, June 25, 2005 7:34 PM
>> > Subject: [RBG7-L] - Locating files in a directory
>> >
>> > I know that you can use choose to select files from
>> > a directory.  I
>> > have been trying to develop a system to
>> > automatically copy the file to
>> > another directory
>> > We have developed a program for automating
>> > classical music
>> > programming and each each in the directory is mark
>> > as follows:
>> >
>> > 0000080 Bach Concerto No. 6 for Harpischord, 2
>> > Recorders, Strings,
>> > and Continuo in  F Major, BWV 1057.MP3
>> >
>> > In the data base we store the cd id as 000080 and
>> > right now I have
>> > set up a table with the file names from the
>> > directory.  What I currently do
>> > is to put quotes
>> > '0000080 Bach Concerto No. 6 for Harpischord, 2
>> > Recorders, Strings,
>> > and Continuo in  F Major, BWV 1057.MP3' around the
>> > title and use the copy
>> > command to transfer it to the receiveing directory.
>> > However, the program
>> > will sometimes select it but most of the time it
>> > will not. The copy command
>> > will not accept * in the transferring file name so I
>> > can not use this
>> > method.
>> > Is the a command similiar to the choose command
>> > that
>> === message truncated ===
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam?  Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
>> --- RBG7-L
>> ================================================
>> TO POST A MESSAGE TO ALL MEMBERS:
>> Send a plain text email to [email protected]
>>
>> (Don't use any of these words as your Subject:
>> INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
>> REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
>> ================================================
>> TO SEE MESSAGE POSTING GUIDELINES:
>> Send a plain text email to [email protected]
>> In the message SUBJECT, put just one word: INTRO
>> ================================================
>> TO UNSUBSCRIBE:
>> Send a plain text email to [email protected]
>> In the message SUBJECT, put just one word: UNSUBSCRIBE
>> ================================================
>> TO SEARCH ARCHIVES:
>> Send a plain text email to [email protected]
>> In the message SUBJECT, put just one word: SEARCH-n
>> (where n is the number of days). In the message body,
>> place any
>> text to search for.
>> ================================================
>>
>>
>>
> 

Reply via email to