3 expanded code
source | link

I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders. My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders. The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files. No timeout message, no error message. And the Finder becomes unresponsive (and remains stuck after the script exits).

set myFolder to choose folder with prompt "Choose a folder:"
    tell application "Finder"
        try
            set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list
        on error
            try
                set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list
            on error
                set eafFiles to {}
            end try
        end try
        try
            set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list
        on error
            try
                set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list
            on error
                set pfsxFiles to {}
            end try
        end try
        set myFiles to eafFiles & pfsxFiles
    end tell

    repeat with CurrentFile in myFiles
        set CurrentFile to CurrentFile as string 

        -- <dodo stuffshell here>script I"perl don't/path/to/perl/script.pl even" get& toquoted thatform partof ...CurrentFile
    end repeat

I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders. My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders. The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files. No timeout message, no error message. And the Finder becomes unresponsive (and remains stuck after the script exits).

set myFolder to choose folder with prompt "Choose a folder:"
    tell application "Finder"
        try
            set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list
        on error
            try
                set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list
            on error
                set eafFiles to {}
            end try
        end try
        try
            set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list
        on error
            try
                set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list
            on error
                set pfsxFiles to {}
            end try
        end try
        set myFiles to eafFiles & pfsxFiles
    end tell

    repeat with CurrentFile in myFiles
        set CurrentFile to CurrentFile as string
        -- <do stuff here> I don't even get to that part ...
    end repeat

I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders. My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders. The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files. No timeout message, no error message. And the Finder becomes unresponsive (and remains stuck after the script exits).

set myFolder to choose folder with prompt "Choose a folder:"
    tell application "Finder"
        try
            set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list
        on error
            try
                set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list
            on error
                set eafFiles to {}
            end try
        end try
        try
            set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list
        on error
            try
                set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list
            on error
                set pfsxFiles to {}
            end try
        end try
        set myFiles to eafFiles & pfsxFiles
    end tell

    repeat with CurrentFile in myFiles
        set CurrentFile to CurrentFile as string 

        do shell script "perl /path/to/perl/script.pl " & quoted form of CurrentFile
    end repeat
2 fixed code
source | link

I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders. My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders. The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files. No timeout message, no error message. And the Finder becomes unresponsive (and remains stuck after the script exits).

set myFolder to choose folder with prompt "Choose a folder:"
    tell application "Finder"
        try
            set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list
        on error
            try
                set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list
            on error
                set eafFiles to {}
            end try
        end try
        try
            set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list
        on error
            try
                set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list
            on error
                set pfsxFiles to {}
            end try
        end try
        set myFiles to eafFiles & pfsxFiles
    end tell

    repeat with CurrentFile in myFiles
        set CurrentFile to CurrentFile as string
        -- <do stuff here> I don't even get to that part ...
    end repeat

I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders. My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders. The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files. No timeout message, no error message. And the Finder becomes unresponsive (and remains stuck after the script exits).

set myFolder to choose folder with prompt "Choose a folder:"
    tell application "Finder"
        try
            set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list
        on error
            try
                set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list
            on error
                set eafFiles to {}
            end try
        end try
        try
            set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list
        on error
            try
                set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list
            on error
                set pfsxFiles to {}
            end try
        end try
        set myFiles to eafFiles & pfsxFiles
    end tell

    repeat with CurrentFile in myFiles
        set CurrentFile to CurrentFile as string
        <do stuff here> I don't even get to that part ...
    end repeat

I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders. My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders. The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files. No timeout message, no error message. And the Finder becomes unresponsive (and remains stuck after the script exits).

set myFolder to choose folder with prompt "Choose a folder:"
    tell application "Finder"
        try
            set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list
        on error
            try
                set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list
            on error
                set eafFiles to {}
            end try
        end try
        try
            set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list
        on error
            try
                set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list
            on error
                set pfsxFiles to {}
            end try
        end try
        set myFiles to eafFiles & pfsxFiles
    end tell

    repeat with CurrentFile in myFiles
        set CurrentFile to CurrentFile as string
        -- <do stuff here> I don't even get to that part ...
    end repeat
1
source | link

Applescript with get every file loop fails

I want to run a script on all files with two specific extensions on a disk with a hierarchy of multiple nested folders. My script works fine when I choose a folder further down the line with fewer subfolders but I'd like to run it on an entire archive with over a thousand folders. The AppleScript takes forever to get all the files and then exits without returning anything and without executing the operations after getting the files. No timeout message, no error message. And the Finder becomes unresponsive (and remains stuck after the script exits).

set myFolder to choose folder with prompt "Choose a folder:"
    tell application "Finder"
        try
            set eafFiles to (every file in entire contents of myFolder whose name ends with ".eaf") as alias list
        on error
            try
                set eafFiles to ((every file in entire contents of myFolder whose name ends with ".eaf") as alias) as list
            on error
                set eafFiles to {}
            end try
        end try
        try
            set pfsxFiles to (every file in entire contents of myFolder whose name ends with ".pfsx") as alias list
        on error
            try
                set pfsxFiles to ((every file in entire contents of myFolder whose name ends with ".pfsx") as alias) as list
            on error
                set pfsxFiles to {}
            end try
        end try
        set myFiles to eafFiles & pfsxFiles
    end tell

    repeat with CurrentFile in myFiles
        set CurrentFile to CurrentFile as string
        <do stuff here> I don't even get to that part ...
    end repeat