04-01-2011 07:25 AM
Hi,
I would like to change the extensions of some files with Labview is that possible? It's like 30 filenames in one map, which I want to do in a loop, but the filenames change every month so I need some kind of code that runs through every file in that map in the order they are present.
Tx in advance
04-01-2011 08:03 AM
04-01-2011 08:13 AM - edited 04-01-2011 08:15 AM
As GerdW suggests, you can move and rename. You can also copy to a new name.
In the attached (V8.5) I grab all of the files in a directory and using an autoindexed loop create new versions with new extensions. If you don't want the old versions either delete them or use Move as GerdW mentions.
04-01-2011 09:26 AM - edited 04-01-2011 09:28 AM
You can also change the extension using regular expressions:
NOTE: Obviously, the paths as strings would come from a Path to String function. Remember: Don't create paths using strings.
04-01-2011 10:51 AM
@smercurio_fc wrote:
You can also change the extension using regular expressions:
Neat (but messing with my head slightly)
In my continuing efforts to understand regex... I think this is doing the following:
\ . means look for the dot before the file extension then,
([^.\\]+) means start at the beginning of the extenstion (^) look for anything followed by a back slash (.\\) and do this search as many times as possible (+)
$ means match from the end of the string (i.e. after the dot used to indicate the file extension rather than before it)
I think I'm missing something in that middle step - what is the backslash for? Please could someone enlighten me?
Thanks
Ian
04-01-2011 12:32 PM
great stuff guys, gonna try it out thanks
04-01-2011 12:49 PM
The middle part basically matches the pieces of text that are not a period or a backslash. Of this set the rest picks out the last one (which should be the extension). RegExr is a good site to analyzer regular expressions.
04-02-2011 04:06 AM
Hi,
I have one more problem to start the rest of the code, I used your suggestions and created .lvm files with several columns of numbers, the first column is date and hour though. I need the first 3 columns of numbers (not the dates and hours) to work with, so i need arrays of those. I can't really find how to do that. I attached an example of a .lvm file.
thanks
04-02-2011 09:11 AM
Never mind I found it, use read spreadsheet with ; as delimiter