LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rate this code.. related to file IO

I am a newbie to Labview... kindly say possible corrections in this
This VI is an application that is capable of Sync the files between Source path and Target Path.
The following Features are necessary,
 Upon pressing check button the s/w should do the steps 1,2,3.
  1) It should compare the files in the source path (Recursively) with the Target Path Recursively.
  2) It should List all the Missing files (in the target path ).
  3) It should list all the Modified files (based on file properties size and date modified.
  4) Upon pressing copy the software should copy the missing files to the target location
  5) upon pressing update the software should update the modified files only(Replace the old files in the
 target location by the new version from source).
  6) upon pressing Sync it has to do both steps 4 and 5.
  7) Exit - Exits the application.
P.S: In simple words, Assume that you are developing an Application that sync the songs to a MP3 player.
Make all other Assumptions and develop the application.
Message 1 of 6
(2,851 Views)

Hi Jason,

remove all local variables, you can use shift registers. Smiley Wink

Mike

Message 2 of 6
(2,837 Views)
Additional comments:
  • I would make subVIs out of the different actions. Then you can make your code an event structure, rather than a state machine that has an event structure in one of its cases. The only time you're performing 2 steps is with "Sync". You can easily do this by calling the 2 "Copy" and "Update" VIs. This eliminates the need to have the "Boolean" control, and allows you to test each operation independently.
  • Rather than displaying an annoying dialog to indicate what you're doing, use a string indicator on the front panel.
  • I'm not sure what the Compare Two Paths VI buys you in what you're doing.
  • Note that when you're comparing modification times you can run into the "1-hour" difference issue that can sometimes occur due to daylight savings time. You may want to account for this.
  • In your "Find Files" case you should be able to use the Search 1D Array function rather than using a while loop.
  • You are not checking for errors with any of the file I/O operations. Important!
Message 3 of 6
(2,805 Views)
You already got two sets of excellent answers, so here are some cleanup operations for a few more issues I noticed:
  1. Some of your buttons overlap on the FP. This causes possibly performance problems redrawing the panel. (check,sync)
  2. You don't need a timeout case. It does nothing once you fix point (3) below.
  3. The terminals of latch action booleans belong inside their respective event structures. This way they reset to FALSE when the event fires (In your case, they get read before the event fires and thus don't reset until after the action occured and the timeout event spins the idle loop once more.
  4. If you would replace the big case structure with an event structure, you don't need any state information
  5. Don't use hidden indocators ("Boolean") to keep state information. A shift register will do.
  6. You don't need to check for "=exit", just read the exit button.
  7. ...
  8. ...

 

Message 4 of 6
(2,783 Views)
Thank you for all your replies
I will be making chages in my code according to ur suggestions
 
 
kindly explain what this '1-hour' difference issue is..


Message Edited by JasonLenox on 08-04-2008 01:54 AM
0 Kudos
Message 5 of 6
(2,751 Views)
As I noted, it has to do with daylight savings time. This can happen on networks when you have one computer that is not properly set to apply daylight savings time. The result is that you can get files that have a time difference of exactly one hour, but in all other respects be exactly the same. If you don't follow daylight savings time then you have nothing to worry about.
Message 6 of 6
(2,723 Views)