error 10684

I’m running a script to count files in a set of folders. Just using “get count of every file in every folder in theSelectedFolder” crashes my system.
I’m presently using “list folder” to get of list of files and folders, processing them in a loop (with one nested loop to handle the first level of folders within theSelectedFolder) and keeping count of the number of files.
If I do this in the Script Editor, with the Event Log open, I fill the log and get an error. If I do it without the Event Log or as an app, I get error 10684, about which I can find no reference.
I’ve upped the memory on the app, with no effect. Any help would be appreciated.

: I’m running a script to count files in a set of folders.
: Just using “get count of every file in every
: folder in theSelectedFolder” crashes my system.
: I’m presently using “list folder” to get of
: list of files and folders, processing them in a loop
: (with one nested loop to handle the first level of
: folders within theSelectedFolder) and keeping count of
: the number of files.
: If I do this in the Script Editor, with the Event Log
: open, I fill the log and get an error. If I do it
: without the Event Log or as an app, I get error 10684,
: about which I can find no reference.
: I’ve upped the memory on the app, with no effect. Any
: help would be appreciated.
Hi Paul,
I don’t know what happens and I don’t will try this, but, just for information, if you want to know what refers to the 10684 error, put your handler into a “try” statement by asking for the error explanation:

on myHandler()
   try
      --the handler here
   on error message
      display dialog message
  end try
end myHandler

This may help you to know what happens and get where is the error.
cya
Roberto

Read the first message, then this update:
I figured out the “count every file in theSelectedFolder” syntax. BUT - the error number is meaningless. I’ve encountered a bunch of meaningless numbers. The issue is one group of files and one folder. Originally the folder had 84 files. Each time the script tried to get a count from that folder it would end with an error. I started moving files around and found that I have 14 files of the original 84 that create the error condition. Any one of them placed in the original folder (with the remaining 70 files) creates the problem. When kept in a separate folder, however, they work fine (and are counted!). Here’s what I’ve tried, without effect:
move all files to a new folder
move problems files into the original folder one at a time
re-save a problem file
If you have any suggestions, please contact me. Thanks!

: If you have any suggestions, please contact me. Thanks!
Hi Paul,
I will give you a quickly written script that may helps you.
Put it in the Script Editor and run it

my moveTheFiles()
on moveTheFiles()
   set varMoved to 0
   set varErrors to 0
   set varDuplicated to 0
   set varBadFile to ""
   set sourceFolder to (choose folder with prompt "Choose the file's source folder") as text
   set targetFolder to (choose folder with prompt "Choose the file's target folder") as text
   tell application "Finder"
      set theFilestoMove to name of every file of folder sourceFolder
      repeat with i from 1 to the number of items of theFilestoMove
         set currentFile to item i of theFilestoMove
         set currentFile to (sourceFolder & currentFile) as text
       try
         move file currentFile to folder targetFolder
         set varMoved to (varMoved + 1)
      on error
         try
            duplicate file currentFile to folder targetFolder
            set varDuplicated to (varDuplicated + 1)
         on error
            set varErrors to (varErrors + 1)
            set varBadFile to (varBadFile & currentFile & return) as text
         end try
      end try
   end repeat
end tell
if varBadFile = "" then set varBadFile to "none"
   display dialog "moved " & varMoved & " files successfull, duplicated " & varDuplicated & " files." & return & "Files causing problems are: " & return & varBadFile

end moveTheFiles

: Thanks Roberto. I’m not sure I understand how this script
: helps me though. My problem is a little more complex
: than “bad files”.
Hi,
I think too. This script only let you know what are the bad files. When you know the bad file, you can repair it, if possible. Is possible the files are corrupted, or writed in a bad block of your disk.
Try to send me by e-mail one of this file, is possible i can get the file problem and give you the way to repair it.
If the application used to create the files can open it, there is no bad disk blocks, the problem is other. Try to “save as” the files with the creator application.
cya
Roberto

Thanks Roberto. I’m not sure I understand how this script helps me though. My problem is a little more complex than “bad files”.