Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Renaming numeric file names
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00020260
Message ID:
00020361
Vues:
50
>>>>I am having a beast of a time renaming numeric filenames
>>>>
>>>>
>>>>VFP 3.0b keeps saying File does not exist or something to that effect (file not found?) but it does.
>>>>
>>>>I tried the following on a fresh exec of vfp:
>>>>
>>>>I created a file called 12345678
>>>>
>>>>rena 12345678 TO junk.txt (file does not exist)
>>>>copy file 12345678 to junk.txt (no problem)
>>>>dele file 12345678 (no problem)
>>>>rena junk.txt to 12345678 (no problem)
>>>>rena 12345678 to junk.txt (file does not exist!)
>>>>
>>>>GRRRRR!!!!!!!!!!!!!!!!
>>>>
>>>>Frustrated and confused needing any input on this problem...(filenames already exist and can't be
>>>>changed due to prior policies that are in place, however I need to be able to temporarily rename them and rename them back again!!!)
>>>>
>>>>Thanks for any assistance.
>>>
>>>Robert: Have you considered taking a step back in time and usinge the RUN command so the renames are done in DOS? Your users will have to put up with the flash of a DOS screen, but all file names would be acceptable.
>>>
>>>This isn't just a VFP problem - I had problems over 5 years ago when a client insisted that all files start with the year - 92jan, 93mar, etc.
>>>
>>
>>I considered it, but . . . If I'm desperate I will, I'm already flashing them w/ PKUNZIP. No use licensing the windows version when we'll be reorganizing w/ in a month.
>>
>>Perhaps there is a Win API call that I can use.
>
>maybe I don't understand, or system differences. I did this and it worked.
>modi comm c:\temp\1234.txt
> wrote some text and closed it
>rename c:\temp\1234.txt to c:\temp\test.txt
>modi comm c:\temp\test.txt
> text was there in ifle. closed it
>rename c:\temp\test.txt to c:\temp\1234.txt
>all ok
>
>Using VFP 5.0 and Win95. Also noticed refrence to implied path in the rename command, maybe this is what is doing it ?

Hi guys,
If you are creating the file at run time, like a cursor, foxpro
doesn't use the "alias" to name the file under dos, it uses
a random number to do that, I found this the hard way, Try this

CREATE CURSOR temp (nField_code N(1))
SELECT temp
APPEND BLANK
REPLACE nField_code WITH 2

and then go to the DOS prompt and try to find a file
with the name "temp", you will not find it, you will find something
like 87896654.tmp in your default temporary directory, that is,
where you had set your "TEMP" in your autoexec, i.e.,
SET TEMP=C:\DOS., so in other words, to find the real
name of your file you have to use DBF(). In the previous
example try this:

?ALIAS()
?DBF()

and you will note the difference. :)

Hope this help.
Good Luck
Luis Guzman, MCP
"The only glory most of us have to hope for
is the glory of being normal." Katherine Fulleton Gerould
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform