Boy, stay off list for a few hours and look what you miss! Sami, this is VERY cool code. Did you draw it from your archives or figure it just for Chuck (gosh, blush)?
I'm intrigued: why do it this way? Is it related to something I discovered a while back in writing my automated database checking / backup program? I found that if the files were embedded very deep in directories, and I tried to build a command like: COPY C:\convdemo\conv2004b\autoback\dbtest.rb? c:\convdemo\conv2004b\autoback\backup using the same trick you've done here, setting a variable to the file source and destination and then using COPY &vFileSource &vBackupLocation I got an error message for invalid use of wild cards if the location strings were too long? Or some other reason? David David Blocker [EMAIL PROTECTED] 781-784-1919 Fax: 781-784-1860 Cell: 339-206-0261 ----- Original Message ----- From: "Sami Aaron" <[EMAIL PROTECTED]> To: "RBG7-L Mailing List" <[email protected]> Sent: Sunday, June 26, 2005 10:13 AM Subject: [RBG7-L] - Re: Locating files in a directory > 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 does not > require me to manually select the file? > Appreciate any suggestions. > Chuck Conrad > > <http://www.karconind.com/> Supporting > the Arts in Indonesia > > Conrad, Charles Dean > President Commissioner PT KarCon Indonesia > Jl. Pondok Betung Raya > Jakarta 15221 > Indonesia > [EMAIL PROTECTED] tel: > fax: > mobile: +62 21 7388-2068 > +62 21 7388-2068 > +62 81 189-7086 > > Add me to your address book... > <https://www.plaxo.com/add_me?u=8589960975&v0=51669&k0=1500330442> > Want a signature like this? <http://www.plaxo.com/signature> > > > >
