finder – How to restore files from time machine backup (on Apple Time Capsule) of a different computer?

I need to find some files located in a time machine backup of an old computer. It’s a backup located on an Apple Time Capsule.

As it’s used as my router, I’ve tried going to Finder, then clicking on the Time Capsule under locations, entering the password and connecting. Then there’s a folder called ‘Data’. Within it there is the backup for the old computer in .dmg file format. From other things I’ve read, when it’s a backup on an external drive there should just be a folder you can click in to, to look at files. That’s not the case here when it’s on a time capsule. If you ‘show package contents’ of the .dmg there’s nothing usable or viewable, just lots of exec files.

I’ve also tried go to time machine in the menu bar and press alt, ‘browse other backup disks’ but that doesn’t seem to work and just shows me a today finder window for my finder.

It would be great if someone knows what to do here. Thanks

finder – There is no application set to open the URL

finder – There is no application set to open the URL – Ask Different

finder – Automatically Delete Files From Downloads Folder Daily Unless Tagged With “Keep”?

Automatically Delete Files From Downloads Folder Daily Unless Tagged With “Keep”?

The following example AppleScript code can be used in a shell script with an /usr/bin/osascript shebang, or an AppleScript script/application, or a Run AppleScript action in an Automator workflow to delete any file in the targetFolder that does not have a custom “Keep” Tag set in Finder:

-- # targetFolder can be either an HFS path or a POSIX path,
-- # "path:to:target:folder:" or "/path/to/target/folder"
-- # 
-- # Change the value of targetFolder from "/path/to/target/folder"
-- # to the appropriate fully qualified pathname in either form.

set targetFolder to "/path/to/target/folder"


-- # The remaining code should not need to be modified, 
-- # unless the mdfind query needs to be changed.

set targetFolderPOSIXpath to ¬
    the quoted form of ¬
        the POSIX path of targetFolder

set shellCMD to {¬
    "mdfind -onlyin", space, targetFolderPOSIXpath, space, ¬
    "'! kMDItemKind == Folder && ! kMDItemUserTags == Keep'"} ¬
    as string

set posixFilesToDelete to ¬
    paragraphs of ¬
    (do shell script shellCMD)

set filesToDelete to {}
repeat with thisFile in posixFilesToDelete
    set thisFile to POSIX file thisFile as alias
    set the end of filesToDelete to thisFile
end repeat

if filesToDelete is not {} then ¬
    tell application "Finder" to ¬
        delete filesToDelete 

Note: Scroll to see remaining code.


Notes:

  • As I do not have the target folder mentioned in the OP, I could not test for any permissions issues that may need addressing in: System Preferences > Security & Privacy > Privacy
  • The example AppleScript code was tested and work for me without issue in macOS Catalina using a temporary folder created within my Home folder while adding files and folders to it and tagging only some files with a custom “Keep” Tag in Finder.
  • As to “Automatically Delete Files” there are a number of different ways to accomplish this depending on how the example AppleScript code is used. If used as an Automator workflow created as a Folder Action using a Run AppleScript action the code can be used as is, replacing the default default code once the targetFolder variable is set.
  • Used as an AppleScript shell script or application it can be scheduled to run at whatever time you’d like, using any of several different methods.

Note: The example AppleScript code is just that and sans any included error handling does not contain any additional error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5, with the value of the delay set appropriately.

itunes – Music app only shows an outdated music library after I’ve retrieved it from BackUp, even though all songs are listed in Finder

I made a clean reinstallation of my MacBook Pro a few days ago due to a problem that had been bugging me for a while now. And, among other things, I tried to retrieve my music library back to the music app. It was the folder „iTunes“.
To get all the settings back I’ve opened the file “iTunes Library.itl“. But unfortunately, it seems to be completely outdated (it’s from late 2019!) which also shows in the music app. There are only songs and playlists listed up to that date, even though the songs in the iTunes Media folder (or to be more specific, in username/music/iTunes/iTunes Media/Music) are all up to date.

I suspect that this happened because of the outdated .itl-file. How can I get back the settings I’ve had a few days back with all my playlists and songs? Or at least, where were the settings I’ve had before the reinstallation saved? I mean, they should have been saved somewhere.

If nothing works, then I’d have to try to sync my iPhone with the Mac. But I’d like to avoid that if possible. For one, because it’s not really up to date (the last time I’ve synchronized it with my Mac was 3 weeks ago). But mainly because of 2 reasons: I’ve lost pretty much all the thumbnails due to an update a few years ago (the thumbnails of all songs have been replaced by an album cover…) and some smart playlists somehow don’t contain all the songs that should have been listed there.

macos – How to stop asr restore remounting image after completion? Or atleast stop the Finder window appearing? (Mac OS X El Capitan)

macos – How to stop asr restore remounting image after completion? Or atleast stop the Finder window appearing? (Mac OS X El Capitan) – Ask Different

macos – How can I disable Finder notifications?

Every time I disconnect my mac from its dock, I get a Finder notification about ejecting a drive before disconnecting. It’s a drive I use for time machine backup, and I just don’t think it’s worth it to take the time to eject it every time I want to move my mac.

Is there a way to disable this notification? The Finder app does not appear in the Notification settings.

Where are the tabs in Safari saved (in iCloud or Finder)?

I want to recover several links of a website I had open as tabs for quite a few months now. But once it has been reloaded today, I’ve been redirected to a notice page of that website (it was temporarily shut down due to maintenance). Unfortunately, there’s no “turn-back” button. So, recovering the previous links doesn’t seem possible. This is why I’m hoping to find a way to recover it by finding out where the tab links have been saved.

I know that you can recover previously closed tabs in Safari directly under “history”. So, the tabs should be saved somewhere.
If it’s saved in Finder, I should be able to easily recover it using Time Machine. If it’s in iCloud, that should be possible, too, unless it automatically overwrites the links with no way to track it back.

Btw., recovering the links (it’s about 20) by browsing through my history would be extremely time consuming as I usually open more than 30 (different) links of that website each day.

Hide the Finder toolbar, but show the sidebar

It seems that the sidebar is automatically hidden (and the menubar option to show it becomes greyed-out) when the toolbar is hidden on Mojave 10.14. Is there a way to hide Finder’s toolbar while keeping the sidebar visible?


More context: I constantly use the sidebar but never, ever use the toolbar. I want as much free screen space as possible. All the toolbar actions I use are more easily accessible with the keyboard:

  • Cmd + Up to go up to the parent folder,
  • Cmd + F to search / Find,
  • Cmd + 1 through 4 for view modes,
  • Cmd + ( or ) to navigate history backward/forward,
  • Cmd + I to open detailed file Information,
  • Cmd + Shift + G to Go to a specific file path.

Related question on different behaviours caused by the toolbar’s opened/closed state: Why does hiding the Finder toolbar cause so many side effects?

Using Finder Items as filter criteria in Automator

I am trying to use the below workflow to:
use a file to find a folder
insert that file that was used into the newly found folder

I thought this would be possible because both the folder and file have the same 5 digit number in the beginning. I would be able to use the number to find the folder by adding that number to the rest of the folder name in a filter action.

Filter Criteria

How do I cut out the 5 digit number from the filename and combine it with text in order to find the specific folder?

I am very new to automator but I get some of the concepts that it requires for usage.

Thanks!

c++ – AI for OpenTTD – A* Path Finder: Follow-up and unique_ptr slow performance

Original review here: AI for OpenTTD – A* Path Finder

If you’d like to run the code yourself: https://github.com/marlonsmith10/empire_ai (use_smart_pointers branch)

Changes have been made based on the previous review. In particular, using std::priority_queue and std::unordered map have dramatically improved performance. However, using std::unique_ptr compared to raw pointers is slowing the code down by about a factor of 2. Since I’m new to unique_ptr, I would appreciate any comments on whether its being used appropriately, and whether performance can be improved. Something that stands out to me is that when using std::unique_ptr, any node in m_closed_nodes must be moved out, checked, and then moved back in. With a raw pointer, this isn’t necessary unless the node is going to be re-opened.

The code also now checks to make sure that roads can be actually built based on the slope of the current tile, so there are no longer any broken connections in roads built along the discovered path.

As in the previous review, any comments on good C++ programming practices are welcome as well.

path.hh

#ifndef PATH_HH
#define PATH_HH


#include "stdafx.h"
#include "command_func.h"
#include <queue>
#include <unordered_map>

namespace EmpireAI
{
    class Path
    {
    public:

        enum Status
        {
            IN_PROGRESS,
            FOUND,
            UNREACHABLE
        };

        Path(const TileIndex start, const TileIndex end);

        // Find a partial path from start to end, returning true if the full path has been found
        Status find(const uint16_t max_node_count = DEFAULT_NODE_COUNT_PER_FIND);

    private:

        struct Node
        {
            Node(TileIndex in_tile_index, int32 in_h)
            : tile_index(in_tile_index), h(in_h)
            {
            }

            Node()
            : tile_index(0), h(0)
            {}

            // Update the Node's g and h values, as well as its previous node. Returns true if the
            // new values are lower than the previous ones.
            bool update_costs(Node* const adjacent_node);

            const TileIndex tile_index;
            Node* previous_node = nullptr;
            int32 g = 0;
            const int32 h;
            int32 f = -1;
        };

        struct NodeCostCompare
        {
            bool operator()(const std::unique_ptr<Node>& node1, const std::unique_ptr<Node>& node2)
            {
                return node1->f > node2->f;
            }
        };


        void parse_adjacent_tile(Node* const current_node, const int8 x, const int8 y);

        // Return the corresponding node or create a new one if none is found
        std::unique_ptr<Node> get_node(const TileIndex tile_index);

        // Get the cheapest open node, returns nullptr if there are no open nodes
        std::unique_ptr<Node> cheapest_open_node();

        // Returns true if a road can be built from one node to the next
        bool nodes_can_connect_road(const Node* const node_from, const Node* const node_to) const;

        // Check this many nodes per call of find()
        static const uint16 DEFAULT_NODE_COUNT_PER_FIND = 20;

        void open_node(std::unique_ptr<Node> node);
        void close_node(std::unique_ptr<Node> node);

        Status m_status;

        Node* m_start_node;
        Node* m_end_node;
        const TileIndex m_end_tile_index;

        // Containers for open and closed nodes
        std::unordered_map<TileIndex, std::unique_ptr<Node>> m_closed_nodes;
        std::priority_queue<Node*, std::vector<std::unique_ptr<Node>>, NodeCostCompare> m_open_nodes;

    public:

        class Iterator
        {
        public:

            Iterator(const Path::Node* node)
            : m_iterator_node(node)
            {}

            bool operator==(const Iterator& iterator) const
            {
                return m_iterator_node == iterator.m_iterator_node;
            }

            const Iterator& operator=(const Path::Node* node)
            {
                m_iterator_node = node;
                return *this;
            }

            bool operator!=(const Iterator& iterator) const
            {
                return m_iterator_node != iterator.m_iterator_node;
            }

            const Iterator& operator++()
            {
                m_iterator_node = m_iterator_node->previous_node;
                return *this;
            }

            Iterator operator++(int)
            {
                Iterator iterator = *this;
                m_iterator_node = m_iterator_node->previous_node;
                return iterator;
            }

            TileIndex operator*() const
            {
                if(m_iterator_node == nullptr)
                {
                    return 0;
                }

                return m_iterator_node->tile_index;
            }

        private:
            const Path::Node* m_iterator_node;
        };

        Iterator begin()
        {
            return Iterator(m_end_node);
        }

        Iterator end()
        {
            return Iterator(m_start_node);
        }
    };
}


#endif // PATH_HH

path.cc

#include "path.hh"

#include "script_map.hpp"
#include "script_road.hpp"
#include "script_tile.hpp"
#include "map_func.h"

#include <algorithm>

using namespace EmpireAI;


Path::Path(const TileIndex start, const TileIndex end)
: m_end_tile_index(end)
{
    // Create an open node at the start
    std::unique_ptr<Node> start_node = get_node(start);
    start_node->f = start_node->h;

    // Keep a pointer to the start node, for use by the iterator once a path has been found
    m_start_node = start_node.get();

    open_node(std::move(start_node));

    m_status = IN_PROGRESS;
}


Path::Status Path::find(const uint16_t max_node_count)
{
    if(m_status != IN_PROGRESS)
    {
        return m_status;
    }

    // While not at end of path
    for(uint16 node_count = 0; node_count < max_node_count; node_count++)
    {
        // Get the cheapest open node
        std::unique_ptr<Node> current_node = cheapest_open_node();

        // If there are no open nodes, the path is unreachable
        if(current_node == nullptr)
        {
            m_status = UNREACHABLE;
            break;
        }

        // If we've reached the destination, return true
        if(current_node->tile_index == m_end_tile_index)
        {
            // Keep a pointer to the end node, for use by the iterator
            m_end_node = current_node.get();
            close_node(std::move(current_node));
            m_status = FOUND;
            break;
        }

        // Calculate the f, h, g, values of the 4 surrounding nodes
        parse_adjacent_tile(current_node.get(), 1, 0);
        parse_adjacent_tile(current_node.get(), -1, 0);
        parse_adjacent_tile(current_node.get(), 0, 1);
        parse_adjacent_tile(current_node.get(), 0, -1);

        // Mark the current node as closed
        close_node(std::move(current_node));
    }

    return m_status;
}


void Path::parse_adjacent_tile(Node* const current_node, const int8 x, const int8 y)
{
    TileIndex adjacent_tile_index = current_node->tile_index + ScriptMap::GetTileIndex(x, y);

    std::unique_ptr<Node> adjacent_node = get_node(adjacent_tile_index);

    // Check to see if this tile can be used as part of the path
    if(nodes_can_connect_road(current_node, adjacent_node.get()))
    {
        if(adjacent_node->update_costs(current_node))
        {
            open_node(std::move(adjacent_node));
        }
        else
        {
            close_node(std::move(adjacent_node));
        }
    }
    else
    {
        close_node(std::move(adjacent_node));
    }
}


bool Path::nodes_can_connect_road(const Node* const node_from, const Node* const node_to) const
{
    // The start node doesn't connect to a previous node, so we can't check it for the correct slope.
    // The pathfinder can only ensure that the next node in the path can connect to the start node.
    if(node_from->previous_node == nullptr)
    {
        return true;
    }

    int32 supports_road = ScriptRoad::CanBuildConnectedRoadPartsHere(node_from->tile_index, node_from->previous_node->tile_index, node_to->tile_index);

    if(supports_road <= 0)
    {
        return false;
    }

    if(!ScriptTile::IsBuildable(node_to->tile_index) && !ScriptRoad::IsRoadTile(node_to->tile_index))
    {
        return false;
    }

    return true;
}


std::unique_ptr<Path::Node> Path::cheapest_open_node()
{
    // While there are open nodes available
    while(!m_open_nodes.empty())
    {
        // Remove the cheapest node from the open nodes list
        std::unique_ptr<Node> current_node = std::move(const_cast<std::unique_ptr<Node>&>(m_open_nodes.top()));
        m_open_nodes.pop();

        // If this node has already been closed, discard it and skip to the next one. Duplicates are expected
        // here because get_node() doesn't check for duplicates for performance reasons.
        if(m_closed_nodes.find(current_node->tile_index) != m_closed_nodes.end())
        {
            continue;
        }

        return current_node;
    }

    // There are no more open nodes
    return nullptr;
}


std::unique_ptr<Path::Node> Path::get_node(const TileIndex tile_index)
{
    // If the node is not closed, create a new one.
    // Duplicate open nodes are considered an acceptable tradeoff since it's not easy to search std::priority_queue for
    // an already existing open node
    if(m_closed_nodes.find(tile_index) == m_closed_nodes.end())
    {
        return std::unique_ptr<Node>(new Node(tile_index, ScriptMap::DistanceManhattan(tile_index, m_end_tile_index)));
    }

    std::unique_ptr<Node> node = std::move(m_closed_nodes.at(tile_index));

    // Remove the (now null) node from the closed list
    m_closed_nodes.erase(tile_index);

    return node;
}


void Path::open_node(std::unique_ptr<Node> node)
{
    // Push the node into the open node list. Does not check open nodes, instead allowing
    // duplicates to be created in the open node priority queue, since checking for already open nodes is slower
    // than just processing a node twice.
    m_open_nodes.push(std::move(node));
}


void Path::close_node(std::unique_ptr<Node> node)
{
    m_closed_nodes(node->tile_index) = std::move(node);
}


bool Path::Node::update_costs(Node* const adjacent_node)
{
    int32 new_g = adjacent_node->g + 1;

    int32 new_f = new_g + h;

    // If this node is closed but cheaper than it was via previous path, or
    // if this is a new node (f == -1), return true to indicate the node should be opened again
    if(new_f < f || f == -1)
    {
        g = new_g;
        f = new_f;
        previous_node = adjacent_node;

        return true;
    }

    return false;
}

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123