applescript: how to copy real file instead of alias, but recursivelyHow can I Remove .DS_Store files from a Git repository?Copy items via Finder and Applescript: how to get “item exists - replace?” dialog in Finder?Using applescript I want to move every file within the folder to the root folderSearching/duplicating multiple files in folder using ApplescriptError Copying a User Chosen Photo With AppleScriptAny reason to use a Git alias instead of a git-* script?AppleScript Automation - Bulk uploading files in folder to a single-upload formApplescript - duplicate file to folderApplescript copy files to specific foldersApplescript to duplicate files from Resources, interacting with Finder, Capture One Pro

Co-workers with a lot of money and openly talk about it

Cases with long math equation

Why did IBM make the PC BIOS source code public?

Do beef farmed pastures net remove carbon emissions?

Telephone number in spoken words

Is there a fallacy about "appeal to 'big words'"?

Shifting tenses in the middle of narration

Does fossil fuels use since 1990 account for half of all the fossil fuels used in history?

How do I ask for 2-3 days per week remote work in a job interview?

How can I communicate my issues with a potential date's pushy behavior?

How was the murder committed?

Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?

What is the prop for Thor's hammer made of?

How would you translate this? バタコチーズライス

How to not forget things?

Did Pope Urban II issue the papal bull "terra nullius" in 1095?

How did Arecibo detect methane lakes on Titan, and image Saturn's rings?

How can I shoot a bow using strength instead of dexterity?

What is the farthest a camera can see?

Chunk + Enumerate a list of digits

Why does the cable resistance jump from a low value to high value at a particular frequency?

Is it really Security Misconfiguration to show a version number?

Are there any cons in using rounded corners for bar graphs?

Do you "gain" 1st level?



applescript: how to copy real file instead of alias, but recursively


How can I Remove .DS_Store files from a Git repository?Copy items via Finder and Applescript: how to get “item exists - replace?” dialog in Finder?Using applescript I want to move every file within the folder to the root folderSearching/duplicating multiple files in folder using ApplescriptError Copying a User Chosen Photo With AppleScriptAny reason to use a Git alias instead of a git-* script?AppleScript Automation - Bulk uploading files in folder to a single-upload formApplescript - duplicate file to folderApplescript copy files to specific foldersApplescript to duplicate files from Resources, interacting with Finder, Capture One Pro






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am using the following script to copy certain folder content from my hard-drive on a usb-Stick. Since the folder content might change, I am using aliases.



The script used to work perfectly, but since I had to make changes in my folder structure, I now have sometimes an alias of an alias (workaround of the script, won´t go into that).



Problem is that the script seems to only convert the first level of alias-folders, but if there is an alias for a file within an alias for a folder, it copies the file-alias.



I wonder if it is possible to tell the script to recursively go through every level of the folder (ie every file) and copy the original file instead.



Thanks!



Peter



ps: exemplary folder structure of source folder:



alias of folder 1



 alias of folder 1-1

alias of file a, alias of file b


alias of folder 2



 alias of file c



--> first a dialogue

display notification "hello, get folder ready"
delay 5 --> allow time for the notification to trigger

set theDialogText to "choose source"
display dialog theDialogText



--> Result: button returned:"OK"


--> now computing

set the backupSource to (choose folder) as alias

set theDialogText to "choose destination"


display dialog theDialogText

--> Result: button returned:"OK"


set the backupDestination to (choose folder) as alias

display notification "maybe this takes a while..."

delay 6 --> allow time for the notification to trigger

--> now copy

tell application "Finder"

activate
with timeout of 600 seconds --> equeals 10 Minutes

set everyAlias to every item of folder backupSource
repeat with thisAlias in everyAlias

set originalFile to (original item of thisAlias)
duplicate originalFile to backupDestination

end repeat
end timeout
end tell
``````````

I feel that the the line "repeat thisAlias in everyAlias" doesn´t do its job and goes only one level down, ie it converts the alias on the first level and not all other aliases within this alias-folder









share|improve this question






























    0















    I am using the following script to copy certain folder content from my hard-drive on a usb-Stick. Since the folder content might change, I am using aliases.



    The script used to work perfectly, but since I had to make changes in my folder structure, I now have sometimes an alias of an alias (workaround of the script, won´t go into that).



    Problem is that the script seems to only convert the first level of alias-folders, but if there is an alias for a file within an alias for a folder, it copies the file-alias.



    I wonder if it is possible to tell the script to recursively go through every level of the folder (ie every file) and copy the original file instead.



    Thanks!



    Peter



    ps: exemplary folder structure of source folder:



    alias of folder 1



     alias of folder 1-1

    alias of file a, alias of file b


    alias of folder 2



     alias of file c



    --> first a dialogue

    display notification "hello, get folder ready"
    delay 5 --> allow time for the notification to trigger

    set theDialogText to "choose source"
    display dialog theDialogText



    --> Result: button returned:"OK"


    --> now computing

    set the backupSource to (choose folder) as alias

    set theDialogText to "choose destination"


    display dialog theDialogText

    --> Result: button returned:"OK"


    set the backupDestination to (choose folder) as alias

    display notification "maybe this takes a while..."

    delay 6 --> allow time for the notification to trigger

    --> now copy

    tell application "Finder"

    activate
    with timeout of 600 seconds --> equeals 10 Minutes

    set everyAlias to every item of folder backupSource
    repeat with thisAlias in everyAlias

    set originalFile to (original item of thisAlias)
    duplicate originalFile to backupDestination

    end repeat
    end timeout
    end tell
    ``````````

    I feel that the the line "repeat thisAlias in everyAlias" doesn´t do its job and goes only one level down, ie it converts the alias on the first level and not all other aliases within this alias-folder









    share|improve this question


























      0












      0








      0


      1






      I am using the following script to copy certain folder content from my hard-drive on a usb-Stick. Since the folder content might change, I am using aliases.



      The script used to work perfectly, but since I had to make changes in my folder structure, I now have sometimes an alias of an alias (workaround of the script, won´t go into that).



      Problem is that the script seems to only convert the first level of alias-folders, but if there is an alias for a file within an alias for a folder, it copies the file-alias.



      I wonder if it is possible to tell the script to recursively go through every level of the folder (ie every file) and copy the original file instead.



      Thanks!



      Peter



      ps: exemplary folder structure of source folder:



      alias of folder 1



       alias of folder 1-1

      alias of file a, alias of file b


      alias of folder 2



       alias of file c



      --> first a dialogue

      display notification "hello, get folder ready"
      delay 5 --> allow time for the notification to trigger

      set theDialogText to "choose source"
      display dialog theDialogText



      --> Result: button returned:"OK"


      --> now computing

      set the backupSource to (choose folder) as alias

      set theDialogText to "choose destination"


      display dialog theDialogText

      --> Result: button returned:"OK"


      set the backupDestination to (choose folder) as alias

      display notification "maybe this takes a while..."

      delay 6 --> allow time for the notification to trigger

      --> now copy

      tell application "Finder"

      activate
      with timeout of 600 seconds --> equeals 10 Minutes

      set everyAlias to every item of folder backupSource
      repeat with thisAlias in everyAlias

      set originalFile to (original item of thisAlias)
      duplicate originalFile to backupDestination

      end repeat
      end timeout
      end tell
      ``````````

      I feel that the the line "repeat thisAlias in everyAlias" doesn´t do its job and goes only one level down, ie it converts the alias on the first level and not all other aliases within this alias-folder









      share|improve this question














      I am using the following script to copy certain folder content from my hard-drive on a usb-Stick. Since the folder content might change, I am using aliases.



      The script used to work perfectly, but since I had to make changes in my folder structure, I now have sometimes an alias of an alias (workaround of the script, won´t go into that).



      Problem is that the script seems to only convert the first level of alias-folders, but if there is an alias for a file within an alias for a folder, it copies the file-alias.



      I wonder if it is possible to tell the script to recursively go through every level of the folder (ie every file) and copy the original file instead.



      Thanks!



      Peter



      ps: exemplary folder structure of source folder:



      alias of folder 1



       alias of folder 1-1

      alias of file a, alias of file b


      alias of folder 2



       alias of file c



      --> first a dialogue

      display notification "hello, get folder ready"
      delay 5 --> allow time for the notification to trigger

      set theDialogText to "choose source"
      display dialog theDialogText



      --> Result: button returned:"OK"


      --> now computing

      set the backupSource to (choose folder) as alias

      set theDialogText to "choose destination"


      display dialog theDialogText

      --> Result: button returned:"OK"


      set the backupDestination to (choose folder) as alias

      display notification "maybe this takes a while..."

      delay 6 --> allow time for the notification to trigger

      --> now copy

      tell application "Finder"

      activate
      with timeout of 600 seconds --> equeals 10 Minutes

      set everyAlias to every item of folder backupSource
      repeat with thisAlias in everyAlias

      set originalFile to (original item of thisAlias)
      duplicate originalFile to backupDestination

      end repeat
      end timeout
      end tell
      ``````````

      I feel that the the line "repeat thisAlias in everyAlias" doesn´t do its job and goes only one level down, ie it converts the alias on the first level and not all other aliases within this alias-folder






      macos applescript alias






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 11:22









      Kevin87-Kevin87-

      61 bronze badge




      61 bronze badge

























          2 Answers
          2






          active

          oldest

          votes


















          0














          I don't have a quick fix, but rather programming advice: it's time to add debugging. In this case, I suspect your script is not operating on the files you intend to use. So what's it doing instead?



          For example, near the beginning,
          set debugOn to true

          or better
          property debugOn : true



          Then right before your duplicate command,



          if debugOn then display dialog ¬
          "Copying thisAlias: " & return & (thisAlias as text) & return & ¬
          "of originalFile: " & return & originalFile buttons "OK" default button 1


          …and so forth. You can leave these if debugOn then… checks throughout your code with dialogs or even different modes of behavior, and just change it to property debugOn : false once it's working. Having it all there is also great for the inevitable day you need to edit the script, but it's aged enough you've forgotten all its nuances.






          share|improve this answer

























          • Thanks Joel, will try.

            – Kevin87-
            Mar 27 at 15:08


















          0














          Maybe this following AppleScript code will help you accomplish what you're looking for?



          tell application "Finder"
          set sourceFolder to choose folder with prompt "CHOOSE SOURCE"
          set destinationFolder to choose folder with prompt "CHOOSE DESTINATION"
          set nestedFolders to a reference to (entire contents of sourceFolder)
          set aliasFiles to a reference to every alias file of nestedFolders
          set aliasFiles to contents of aliasFiles
          repeat with i from 1 to count of aliasFiles
          set thisItem to item i of aliasFiles
          if not (exists of original item of thisItem) then
          delete thisItem
          end if
          end repeat
          set aliasFiles to a reference to every alias file of nestedFolders
          set originalFiles to (original item of aliasFiles) as alias list
          duplicate originalFiles to destinationFolder
          end tell





          share|improve this answer





























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55376004%2fapplescript-how-to-copy-real-file-instead-of-alias-but-recursively%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I don't have a quick fix, but rather programming advice: it's time to add debugging. In this case, I suspect your script is not operating on the files you intend to use. So what's it doing instead?



            For example, near the beginning,
            set debugOn to true

            or better
            property debugOn : true



            Then right before your duplicate command,



            if debugOn then display dialog ¬
            "Copying thisAlias: " & return & (thisAlias as text) & return & ¬
            "of originalFile: " & return & originalFile buttons "OK" default button 1


            …and so forth. You can leave these if debugOn then… checks throughout your code with dialogs or even different modes of behavior, and just change it to property debugOn : false once it's working. Having it all there is also great for the inevitable day you need to edit the script, but it's aged enough you've forgotten all its nuances.






            share|improve this answer

























            • Thanks Joel, will try.

              – Kevin87-
              Mar 27 at 15:08















            0














            I don't have a quick fix, but rather programming advice: it's time to add debugging. In this case, I suspect your script is not operating on the files you intend to use. So what's it doing instead?



            For example, near the beginning,
            set debugOn to true

            or better
            property debugOn : true



            Then right before your duplicate command,



            if debugOn then display dialog ¬
            "Copying thisAlias: " & return & (thisAlias as text) & return & ¬
            "of originalFile: " & return & originalFile buttons "OK" default button 1


            …and so forth. You can leave these if debugOn then… checks throughout your code with dialogs or even different modes of behavior, and just change it to property debugOn : false once it's working. Having it all there is also great for the inevitable day you need to edit the script, but it's aged enough you've forgotten all its nuances.






            share|improve this answer

























            • Thanks Joel, will try.

              – Kevin87-
              Mar 27 at 15:08













            0












            0








            0







            I don't have a quick fix, but rather programming advice: it's time to add debugging. In this case, I suspect your script is not operating on the files you intend to use. So what's it doing instead?



            For example, near the beginning,
            set debugOn to true

            or better
            property debugOn : true



            Then right before your duplicate command,



            if debugOn then display dialog ¬
            "Copying thisAlias: " & return & (thisAlias as text) & return & ¬
            "of originalFile: " & return & originalFile buttons "OK" default button 1


            …and so forth. You can leave these if debugOn then… checks throughout your code with dialogs or even different modes of behavior, and just change it to property debugOn : false once it's working. Having it all there is also great for the inevitable day you need to edit the script, but it's aged enough you've forgotten all its nuances.






            share|improve this answer













            I don't have a quick fix, but rather programming advice: it's time to add debugging. In this case, I suspect your script is not operating on the files you intend to use. So what's it doing instead?



            For example, near the beginning,
            set debugOn to true

            or better
            property debugOn : true



            Then right before your duplicate command,



            if debugOn then display dialog ¬
            "Copying thisAlias: " & return & (thisAlias as text) & return & ¬
            "of originalFile: " & return & originalFile buttons "OK" default button 1


            …and so forth. You can leave these if debugOn then… checks throughout your code with dialogs or even different modes of behavior, and just change it to property debugOn : false once it's working. Having it all there is also great for the inevitable day you need to edit the script, but it's aged enough you've forgotten all its nuances.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 27 at 13:15









            Joel ReidJoel Reid

            6551 gold badge5 silver badges10 bronze badges




            6551 gold badge5 silver badges10 bronze badges















            • Thanks Joel, will try.

              – Kevin87-
              Mar 27 at 15:08

















            • Thanks Joel, will try.

              – Kevin87-
              Mar 27 at 15:08
















            Thanks Joel, will try.

            – Kevin87-
            Mar 27 at 15:08





            Thanks Joel, will try.

            – Kevin87-
            Mar 27 at 15:08













            0














            Maybe this following AppleScript code will help you accomplish what you're looking for?



            tell application "Finder"
            set sourceFolder to choose folder with prompt "CHOOSE SOURCE"
            set destinationFolder to choose folder with prompt "CHOOSE DESTINATION"
            set nestedFolders to a reference to (entire contents of sourceFolder)
            set aliasFiles to a reference to every alias file of nestedFolders
            set aliasFiles to contents of aliasFiles
            repeat with i from 1 to count of aliasFiles
            set thisItem to item i of aliasFiles
            if not (exists of original item of thisItem) then
            delete thisItem
            end if
            end repeat
            set aliasFiles to a reference to every alias file of nestedFolders
            set originalFiles to (original item of aliasFiles) as alias list
            duplicate originalFiles to destinationFolder
            end tell





            share|improve this answer































              0














              Maybe this following AppleScript code will help you accomplish what you're looking for?



              tell application "Finder"
              set sourceFolder to choose folder with prompt "CHOOSE SOURCE"
              set destinationFolder to choose folder with prompt "CHOOSE DESTINATION"
              set nestedFolders to a reference to (entire contents of sourceFolder)
              set aliasFiles to a reference to every alias file of nestedFolders
              set aliasFiles to contents of aliasFiles
              repeat with i from 1 to count of aliasFiles
              set thisItem to item i of aliasFiles
              if not (exists of original item of thisItem) then
              delete thisItem
              end if
              end repeat
              set aliasFiles to a reference to every alias file of nestedFolders
              set originalFiles to (original item of aliasFiles) as alias list
              duplicate originalFiles to destinationFolder
              end tell





              share|improve this answer





























                0












                0








                0







                Maybe this following AppleScript code will help you accomplish what you're looking for?



                tell application "Finder"
                set sourceFolder to choose folder with prompt "CHOOSE SOURCE"
                set destinationFolder to choose folder with prompt "CHOOSE DESTINATION"
                set nestedFolders to a reference to (entire contents of sourceFolder)
                set aliasFiles to a reference to every alias file of nestedFolders
                set aliasFiles to contents of aliasFiles
                repeat with i from 1 to count of aliasFiles
                set thisItem to item i of aliasFiles
                if not (exists of original item of thisItem) then
                delete thisItem
                end if
                end repeat
                set aliasFiles to a reference to every alias file of nestedFolders
                set originalFiles to (original item of aliasFiles) as alias list
                duplicate originalFiles to destinationFolder
                end tell





                share|improve this answer















                Maybe this following AppleScript code will help you accomplish what you're looking for?



                tell application "Finder"
                set sourceFolder to choose folder with prompt "CHOOSE SOURCE"
                set destinationFolder to choose folder with prompt "CHOOSE DESTINATION"
                set nestedFolders to a reference to (entire contents of sourceFolder)
                set aliasFiles to a reference to every alias file of nestedFolders
                set aliasFiles to contents of aliasFiles
                repeat with i from 1 to count of aliasFiles
                set thisItem to item i of aliasFiles
                if not (exists of original item of thisItem) then
                delete thisItem
                end if
                end repeat
                set aliasFiles to a reference to every alias file of nestedFolders
                set originalFiles to (original item of aliasFiles) as alias list
                duplicate originalFiles to destinationFolder
                end tell






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 27 at 23:08

























                answered Mar 27 at 20:20









                wch1zpinkwch1zpink

                1,6041 gold badge4 silver badges15 bronze badges




                1,6041 gold badge4 silver badges15 bronze badges






























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55376004%2fapplescript-how-to-copy-real-file-instead-of-alias-but-recursively%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현