Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-nameing a csv file

Status
Not open for further replies.

tenbellies

Programmer
Dec 20, 2002
17
GB
I have wrote a screen scrap that puts all info into a text file, this infomation is overwritten every time it runs but i have been asked to keep the previous data for comparison. What i want to do is re-name the .csv file before the new one is ran eg data.csv would become data1.csv
 
Just use the Name command:

Name "c:\data.csv" as "c:\data1.csv"


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks for the tip but am getting a error this is what i have written in:

Name = "D:\TrawlFiles\CAMSS\frp.txt" as "D:\TrawlFiles\CAMSS\frp1.txt"

i get the error expected end of statement on the "as" part
 
Hi,

I don't use this command but it may be because you're trying to assign a value to name.

Name = "D:\TrawlFiles\CAMSS\frp.txt" as "D:\TrawlFiles\CAMSS\frp1.txt"

John uses

Name "c:\data.csv" as "c:\data1.csv" in his example with no =s operator.


William
Software Engineer
ICQ No. 56047340
 
bit late to the party but I usually check if both files already exist so that I can KILL the one and not bother with the NAME if the target file is not there. It pays dividends later when you forget and do something to the file.

IF dir(file2)<>&quot;&quot; then KILL file2
IF dir(file1)<>&quot;&quot; then NAME file1 AS file2
 
I have a slight problem this works but will not over right any previous files that are exists... didn't look closely enough before
 
Check cresby's answer


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top