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.
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.
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.
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
Ha.. This things I have never tried with that question only I tried doing it. Thanks Jeff.
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?
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.