From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-07-2012 11:07 AM
In my C:\, I have a number of folders, namely C:\myfolder1, C:\myfolder2, C:\myfolder3.. and in each folder, I have several text file *.txt.
I want to have a code which scan through all the C:\myfolder* , and rename the text file to bin file, eg. abc.txt to abc.bin.
I know I can do this easily using command prompt. But how can I do this in LV?
Main thing is how to go through all myfolder*?
Solved! Go to Solution.
05-07-2012 11:14 AM
To get you started, look in the Advanced File Fuctions pallete for "ListFolder.vi". It can give you a list of subfolders and/or files in a folder. There is also the "Recursive File List.vi" which will even search inside the subfolders.
05-07-2012 11:32 AM
Upto my knowledge there is no direct function for Renaming but you can do by moving the file and pasting with the target file. See the attached example.
05-07-2012 11:42 AM - edited 05-07-2012 11:43 AM
a small mod to P's code. Copy file and delete file to an effective job of renaming and you probably want to keep the name and just replace the extension to avoid that bad file name error popping up all the time
05-07-2012 11:45 AM
Ha.. This things I have never tried with that question only I tried doing it. Thanks Jeff.
05-10-2012 03:12 AM
Hi P Anand,
Your VI does not work.
Is it supposed to search in C:\, find all the *.txt file and rename them to *.bin? Can't seem to get it to work. Or did I miss anything?
05-10-2012 03:22 AM
Hi Jeff,
Your VI doesn't seem to work either...
05-10-2012 03:29 AM
Both the code will work but don't give the C: or 😧 as a path because it searches deep into all the directory thats why it seems not working go to a particular folder and try renaming a .txt file it will work.
05-10-2012 03:35 AM
Oh yes both works 😛
but why is that Jeff solution, it rename file1.txt to file1file1.bin?
05-10-2012 03:42 AM
I'd do a System exec "rename *.txt *.bin" 🙂
/Y