LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search and copy missing files

I am trying to search two different folders and find the files in the source folder that aren't in the target folder.  Right now I have an array of files coming out of two recursive file lists and into a For Loop, but the For Loop doesn't run.  I'm also not sure the code insidethe for loop is correct, mainly because I haven't figured out how to get it to run to see if it does work.  I'm sure it's something simple that I've overlooked.

 

Does anybody have any ideas as to what is going on.

 

Thanks in advance.

0 Kudos
Message 1 of 4
(2,559 Views)

If any of the two folders has no files, the bigger for loop will run 0 times, that will probably cause your issue.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 4
(2,551 Views)

Yes,  the target folder wouldn't initially have any files in it until after the first time I copy the contents of the source folder, which is unavoidable.  Perhaps I could have a differnt vi for the initial copy?    The reason for searching for missing files is so that if I have new files in the source folder and subfolders it will find them and copy them to the target folders and subfolders.  I'm hoping to prevent having to copy the entire source folder and consequently replacing the exisiting files that already exist in the target folder.  What I'll be moving is images , possibly a couple of thousand, which is why I only want to copy the missing files/images.

 

Maybe I'm going about this all wrong and there are easier ways to search and copy files and folders.  .  I'm just not sure what is the most efficient way to copy numerous large files.  I'm completely open to suggestions.

 

Thanks for the quick reply.

0 Kudos
Message 3 of 4
(2,544 Views)

Well, I finally got it to work after some trouble with getting it to copy the file itself instead of creating a folder named after the file and then copying everything to that folder.  If that makes sense.

 

I had to have it check to see if the main folder existed and if it didn't, it copied the entire contents of the source folder.  If it found the source folder than it started searching for missing files in the target folder.  Thanks for the tip in the post above about the For Loop not running because there weren't any files in the target folder.

Search For & Copy Missing Files.png

0 Kudos
Message 4 of 4
(2,531 Views)