2

How can I copy the Desktop folder from machine A to machine B and preserve the current icon layout?

I want to replicate the Desktop contents and layout in both machines. I mean the actual Desktop, not a Finder window when opened to ~/Desktop.

I tried copying the ~/Desktop/.DS_Store from A to B but it did not work.

I also tried to create a tar file with ~/Desktop in A and the open the tar file in B, but it did not work: the layout wasn't replicated.

5
  • 1
    @user3439894 I read this as "icon layout on the desktop itself". Not sure this actually is stored in .DS_Store.
    – nohillside
    May 6, 2021 at 15:30
  • @user3439894, I've edited the question with some details.
    – lhf
    May 6, 2021 at 15:35
  • @nohillside, if not in .DS_Store, where is the layout stored?
    – lhf
    May 6, 2021 at 15:36
  • .DS_Store is for when you view the contents of ~/Desktop in a Finder window, not for the actual desktop itself. On top of that the desktop layout depends on the attached monitor, resolution, DPI and monitor count. May 6, 2021 at 18:24
  • 1
    @John Keates, RE: ".DS_Store is for when you view the contents of ~/Desktop in a Finder window, not for the actual desktop itself." -- As it turns out the ~/Desktop/.DS_Store file does indeed contain the Desktop icon layout info, and while I didn't mention it in my answer, nonetheless, their positions adjusts automatically as the screen resolution changes, thus maintaining the same reletive layout. May 11, 2021 at 14:15

2 Answers 2

2

I can now confirm that the layout of files and or folders that are within the ~/Desktop folder and show on the Desktop are indeed stored in the ~/Desktop/.DS_Store file.

That said, the layout is also controlled by the View Options for the Desktop and the settings for both systems need to match. In other words, assuming Sort By it set to None on the source computer, it is also set to None on the destination computer.

Copy the source files and or folders to the Desktop of the destination computer.

After copying the source files and or folders to the Desktop of the destination computer, then in Terminal, on the destination computer, run the following compound command:

cp /path/to/copied/.DS_Store ~/Desktop; killall Finder

You should now see the same layout as on the source computer.

1
  • Indeed, it works! Restarting the Finder seems to be the key. Thanks.
    – lhf
    May 11, 2021 at 12:51
1

You can use the terminal with commands :

On A Mac to a external drive formatted hfs or apfs

cp -av ~/Desktop /Volumes/Destination

Then on the B machine with a User Admin different that this one you would change the Desktop, you rename Desktop directory (with sudo) :

sudo mv /Users/username/Desktop /Users/username/Desktop.o

then you replace with the new :

sudo cp -a /Volumes/Destination/Desktop /Users/username

and affect this "Desktop" to the User "destination"

sudo chown -R username:staff /Users/username/Desktop
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .