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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copy entire folder?

Hello all,

This should be something easy, but I just can't figure it out.

I need to copy an entire folder over, but the destination folder already exists and has files in it. I need to add the files from my local folder to the destination folder.

The Copy function won't do this. Is there any way with conventional LabVIEW programs? Are there any out there?

Usually when something like this comes up, I'll use SystemExec.vi (to use the xcopy command), but that is just completely broken. with LV 7.1. I've tried "xcopy...", "command.com /c xcopy...", making it into a batch file.. etc. No luck.
0 Kudos
Message 1 of 4
(3,185 Views)
Attached is a copy of the OpenG copy vi (I hope I'm not violating licensing agreement here) See if this helps if it does go to openg.org to download and install the commander and the packages it a great tool that I cannot code without. let me know if you need further assistance.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 4
(3,175 Views)
Well, it looks like that won't copy entire folders, but thanks for the link - I didn't know about those packages. They should come in handy in the future.

Also, in case anyone reads this later on, I found out that SystemExec does work to an extent - I can run commands like "copy", but for some reason, it won't run "xcopy". On top of that, you can make a batch (.bat) file with the "copy" command, and it'll work. But the bizarre part is if your .bat file has "xcopy" it doesn't work.

If I find a solution, I'll post it. If not, I'll just use a bunch of For loops to copy each file/folder individually.

-- Rick
0 Kudos
Message 3 of 4
(3,163 Views)
Hi Rick:

Try the example code attached to this post. I tried it out and it worked for me, I think it does what you are asking for.

Emilie S.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 4
(3,151 Views)