LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copy files to another directory

Solved!
Go to solution

Before I go re-inventing the wheel again, does anyone know of a LabVIEW function that can do the following:

 

If I have a folder with files A, B, C, D, E, F,G

and another folder with only files A,C,D,E

 

Is there a function that checks one folders' contents against anothers, then copies any files that dont exist in the other folder?

Off the top of my head I think I could write something that could do this, but if it already exists, whats the point :smileywink: .

Cory K
Message 1 of 8
(17,385 Views)
Solution
Accepted by Cory_K

I recently put together something like this, but probably too specific to my files to help you. By using the following vis you should be able to put one together pretty quick:

 

1. Recursive File List

2. Check if File or Folder Exists

3. Copy

 

These are all locate in File I/O, Advanced File Functions.

Message 2 of 8
(17,380 Views)
I attached the VI that I came up with. I just wasnt sure if there was an easier way.
Cory K
Message 3 of 8
(17,370 Views)
Also, how could I add this: If file A already exists, overwrite the more current version of the file.
Cory K
0 Kudos
Message 4 of 8
(17,367 Views)

The File/Directory Info VI has a last modified output.  

 

last mod indicates the date and time at which the file or directory was last modified. The number is a time zone-independent number of seconds that have elapsed since 12:00 a.m., Friday, January 1, 1904, Universal Time. 

 

You can use the straightforward Greater than or Less than to determine which is the newer version

Message Edited by elset191 on 02-10-2009 12:10 PM
--
Tim Elsey
Certified LabVIEW Architect
Message 5 of 8
(17,362 Views)

I modified the vi to allow the user to select a backup time and day, so that it becomes automatic.  This works well, but I will also need to backup any files in folders that exist inside the source folder.

 

So I need to read the source folder, then add the folder to the path, then copy the files in that folder. 

 

How would I modify the VI to do this?

 

 

 




metzler CLAD
Message 6 of 8
(16,784 Views)

Could you give me a brief description on how the code auto backup folder files.vi works.

 

Thanking You.

Vindsan

0 Kudos
Message 7 of 8
(15,008 Views)

The Auto Backup Folder Files VI is essentially an extension of the VI mentioned earlier in the forum that could look to see if files existed in folder A but not in folder B, and then copy the appropriate files to folder B. It “backs up” files based on a user-defined date using the same logic outlined above, and has the ability to create new files, write to later versions of a file, and/or replace old versions of files with new versions. You could say that it’s a “smarter” version of the VI proposed at the beginning of the forum.

Ross S.
Applications Engineering
National Instruments
0 Kudos
Message 8 of 8
(14,964 Views)