LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I delete the first n records of a datalogfile?

The aim of the query is to form a method to constrain a datalog file to be no greater than a specfied size.

i.e query the size of the file if > x delete first n records.

Alternatively I could re-write the file from record number x, but in this case it would be better to keep the file name the same by e.g write to new file from old file, delete old file, rename new file with old file name.

Problem is I cant find a method of renaming files references in database produce new names e.g with incremented numbers include in file name.

Environment is LabVIEW 6i

Thanks in anticipation

Steve M
0 Kudos
Message 1 of 5
(2,520 Views)
Datalog files in LabVIEW are append-only so the only alternative is rewrite new/delete old/rename new to old. However, I think that the timestamps are not preserved and take the time value of the rewrite time.

> Problem is I cant find a method of renaming
> files references in database produce
> new names e.g with incremented numbers
> include in file name.

Please elaborate... This sentence makes no sense.


LabVIEW, C'est LabVIEW

0 Kudos
Message 2 of 5
(2,520 Views)
Dear Jean-Pierre

Thanks for the reply; it is useful in that it has saved me a lot of fruitless work searching for a method to delete records.

> Problem is I cant find a method of renaming
> files references in database produce
> new names e.g. with incremented numbers
> include in file name.

The paragraph above, in which I did not express myself clearly enough, was referring to a search of NI’s support database, which produced the following reference.

http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/ef7594e0f838814b86256556006258cc?OpenDocument

"Renaming Files Programmatically”

“This VI shows how to programmatically change the name of a file. This program will include the time and date in the fi
lename as well as the copy number. This example uses String Subset, Match Pattern and Concatenation of Strings"

This appears to be the answer I was looking for, but what it actually does is to read an existing file name, determine a numeric component in the name, increments this numeric, and creates a new file with the incremented copy number.

For example reads file1.dat and produces file2.dat. File1.dat can now obviously be deleted etc.

I was just being lazy and wanted to avoid the programming overhead of keeping track of the numeric version.

I was looking for a method to, as you put it, “rewrite new/delete old/rename new to old.” But I can’t find a method of renaming files. If you know of such a method it would be appreciated. Though it occurs to me that if there is a power out whilst renaming, I may run the risk of loosing the shortened file, therefore it may be better to incorporate and track the copy number.

Thanks again.

Regards

Steve M
0 Kudos
Message 3 of 5
(2,520 Views)
Renaming a file is easy but not intuitive...
Use the Move file primitive, with the old name as source and new name as destination.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 5
(2,520 Views)
Thanks Jean-Pierre, it seems obvious now you have given me the method.

Regrds
Steve Munnoch
0 Kudos
Message 5 of 5
(2,520 Views)