No announcement yet.

Get File Count

  • Filter
  • Time
  • Show
Clear All
new posts

  • Get File Count

    Not sure if anyone will have a use for this, but in the interest of sharing...

    When using AMS to copy files to the Hard Drive, I needed to be sure the copy wasn't cancelled. The only way I could think of was to do a file count on the destination folder and see if it was equal to or greater than the source. I was able to do this with AMS, but as the number of files increased, so did the time it took to get the file count.

    Here is a sample project that implements the method I used from AMS and a method using a custom DLL that I wrote.

    Is there a better way to do this using AMS?


  • #2
    Re: Get File Count

    McNifty McStuff.

    Corey Milner
    Creative Director, Indigo Rose Software


    • #3
      Re: Get File Count

      I was looking in the Users Guide and didn't see anything, but was wondering. If the file.copy dialog were to be cancelled, does that result in an error or can you store that answer in a variable somewhere. If that is the case, you would be able to act on that. But I didn't see that. Nice dll by the way.
      "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
      "Draco dormiens nunquam titillandus."
      Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine


      • #4
        Re: Get File Count

        That's what I was hoping for. Best I can tell, the file-copy-cancel doesn't give any feedback. Hence the reason for needing the compare.


        • #5
          Re: Get File Count

          Hey. I found a very easy way to check this to. Maybe a few people could double check this, but on my machine this worked flawlessly. I'm guessing this would work if you were doing an extract from zip file too.
          1. In the folder that contains all of the files you are copying create a new text file, and type zzz.zzz for a file name.
          2. Make sure it is copied with all of the files IN THE SAME COPY action that is copying all of your other files.
          3. When you want to verify that all of the files have been copied, use a file/get information action to check the location you copied to for the existence of the file zzz.zzz

          zzz.zzz will(or should) be the very last file to be copied, as long as you are using the wildcard *.*, and not copying in some arranged order.
          So obviously, if it is the last file copied, all of the files before it were copied, and you have succesfully copied all of the files. Make sure you don't check the box that says "continue copying even if one or more fails", This way if, for example, you had a damaged disk, and it didn't copy a file, it will stop copying(you don't want that zzz.zzz file there if all the files didn't copy properly), and your verifier will not find the file which would allow it to continue.


          • #6
            Re: Get File Count

            Long story short...Maybe you can just check for the last file that would be copied and if that exists then ur ok!