Homebrew macOS - Fix archive attributes for switch SD card

Player_One

Member
OP
Newcomer
Joined
Aug 9, 2019
Messages
12
Trophies
0
Age
35
XP
261
Country
Russia
switchSD.png
switchSD

Info:
Mac OS users are having trouble reading an SD card on the Nintendo Switch. This is all because the archive file attribute of HOS (Nintendo Switch OS) and macOS are used for different purposes.
I wrote a small application (applescript) that removes archive attributes for all files and folders on the Switch SD card.
It also takes into account the specificity of .nca folders and fixed them.
And lastly, it cleans up hidden unnecessary files for the Switch that macOS created when you worked with SD through the Finder.
In the new version, you can choose where you want to fix the attributes. On the entire map except the Nintendo folders on it (so as not to violate the attributes of the nca folders)
or you can fix the attributes of the Nintendo folders(if something is wrong with .nca attributes).

How to use:
1. Perform all the actions you need with the files and folders on the switch SD card.

2. Select the name of the SD card from the list.
Screen Shot 2019-09-17 at 1.34.00 AM.png
3. Select a direction to fix:
Screen Shot 2019-09-04 at 12.24.31 AM.png
(a) Fix bit all files - will remove the archive bit for all files and folders on SD except Nintendo folders.
(b) Fix bit Nintendo folders - restore archive bit for all .nca on SD card.

4. Enter the administrator password.
Screen Shot 2019-08-09 at 12.36.07 PM.png

5. (a) Fix bit all files - the process is pretty fast
Screen Shot 2019-09-04 at 12.29.16 AM.png
5. (b) Fix bit Nintendo folders - This process is not fast and depends on the number of .nca on the SD card.
Screen Shot 2019-08-24 at 4.57.16 PM.png

6. Wait for notification of the end of the processes.

Done - Insert the SD card into the Switch.
Screen Shot 2019-08-09 at 12.36.32 PM.png

Note:
You may need to allow applications not installed by Apple developers to be launched.
To do this, run the command in Terminal " sudo spctl --master-disable "
Screen Shot 2019-08-09 at 6.45.14 PM.png


Code:
#switchSD v0.3.4

#by PlayerOne


property rm : "sudo rm -rf "

property arch : "sudo chflags -R arch "


set disksExternal to do shell script "mount | awk '/Volumes/ { print $3 }'"

set diskExternal to every paragraph of disksExternal


choose from list diskExternal with prompt "Select SD card for Nintendo Switch"

set the switchSD to the result

if switchSD is equal to false then return

set switchSD to quoted form of POSIX path of (switchSD as string)


set Fix to button returned of (display dialog "What do you want to fix?" buttons {"Fix bit Nintendo folders", "Fix bit all files"})


do shell script "sudo touch " & switchSD & " .metadata_never_index" with administrator privileges


if Fix is "Fix bit all files" then

    set bitArchFiles to do shell script "find " & switchSD & "/* -path " & switchSD & " -prune -o -path " & switchSD & "/emuMMC -prune -o -path " & switchSD & "/Emutendo -prune -o -path " & switchSD & "/Nintendo -prune -o -depth 0 -print" with administrator privileges

    set archFiles to every paragraph of bitArchFiles

   

    set ProgressDialog to length of archFiles

    set progress total steps to ProgressDialog

    set progress completed steps to 0

    set progress description to "Fix bit all"

    set progress additional description to ""

   

    repeat with bit from 1 to length of archFiles

        set archBit to item bit of archFiles

        set progress additional description to POSIX path of archBit

        do shell script "sudo chflags -R arch " & quoted form of archBit with administrator privileges

        set progress completed steps to bit

    end repeat

end if



if Fix is "Fix bit Nintendo folders" then

    set listNCAs to do shell script "find " & switchSD & "/ -name '*.nca' | grep .nca"

    set NCAs to every paragraph of listNCAs

   

    set ProgressDialog to length of NCAs

    set progress total steps to ProgressDialog

    set progress completed steps to 0

    set progress description to "Fix bit NCA folders"

    set progress additional description to ""

   

    repeat with a from 1 to length of NCAs

        set nca to item a of NCAs

        set progress additional description to POSIX path of nca

        set ncaF to do shell script "echo " & quoted form of nca & " | cut -d'.' -f-1"

        do shell script "mkdir " & quoted form of ncaF with administrator privileges

        do shell script "mv " & quoted form of nca & "/* " & quoted form of ncaF with administrator privileges

        do shell script rm & quoted form of nca with administrator privileges

        do shell script "mv " & quoted form of ncaF & " " & quoted form of (ncaF & ".nca") with administrator privileges

        set progress completed steps to a

    end repeat

end if


set progress total steps to 0

set progress completed steps to 0



do shell script "find " & switchSD & " -name '._*' -delete"

do shell script "find " & switchSD & " -name '.DS_Store' -delete"

do shell script rm & switchSD & "/.metadata_never_index" with administrator privileges

do shell script rm & switchSD & "/.Trashes" with administrator privileges

do shell script rm & switchSD & "/.fseventsd*" with administrator privileges

do shell script rm & switchSD & "/.Spotlight-V100" with administrator privileges



set progress description to "Unmount SD card"

set progress additional description to (switchSD as string)

do shell script "sudo diskutil unmount " & switchSD with administrator privileges

do shell script "afplay /System/Library/Sounds/Glass.aiff"

display notification "SwitchSD- Done" with icon


set progress description to ""

set progress additional description to ""

Version:

switchSD - v0.1
- the script works

switchSD - v0.2
- Added a progress bar to observe the process.

switchSD - v0.3
- The path selection for SD is changed, now the script checks external disks and displays the names.
- Separation of functions on fix bit for everything except .nca and fix bit .nca folders.
- Fixed the work of paths if the disc name contains spaces.

switchSD - v0.3.1
- Fixed bug bit archive for emuMMC folder.

switchSD - v0.3.2
- Changed drive search, now search all drives. The drive name must not contain spaces.

switchSD - v0.3.3
- add touch command .metadata_never_index (fix delete .Spotlight-V100 folder)

switchSD - v0.3.4
- bugfix Spotlight-V100 folder (10.15 too?), add Emutendo folder.
 

Attachments

  • switchSD_3.4.zip
    141.3 KB · Views: 785
Last edited by Player_One,

stick267

Well-Known Member
Member
Joined
Dec 17, 2018
Messages
586
Trophies
0
Age
33
XP
1,171
Country
United States
I find myself just using nxmtp to get around all of macOS's archive bit and dot file nonsense, so this could be very useful. Thanks.
 

Player_One

Member
OP
Newcomer
Joined
Aug 9, 2019
Messages
12
Trophies
0
Age
35
XP
261
Country
Russia
I find myself just using nxmtp to get around all of macOS's archive bit and dot file nonsense, so this could be very useful. Thanks.
all right. but it’s not always possible to start it homebrew, for example, when you first create an SD for a switch, the “switch” folder also has an archive attribute. And it should be removed for hbmenu to work properly. Also, these attributes interfere if you put mods or translations with titles. The application allows you not to think about it. And so everything is possible with your hands)
 

Player_One

Member
OP
Newcomer
Joined
Aug 9, 2019
Messages
12
Trophies
0
Age
35
XP
261
Country
Russia
Sounds like a great app, however I doesn't list my sd card.
This happened because the Apple card reader is PCIe and initializes the SD card as an internal drive. So I redid the external drive search. Now it finds all disks except the system one.
Try the new version (0.3.2).
 
Last edited by Player_One,

Tumbleweed

Well-Known Member
Member
Joined
Jul 29, 2018
Messages
165
Trophies
0
Age
39
XP
1,448
Country
Italy
Until now I've used Parallels to manage all my switch transfers, one corruption so far, I will give this a try, tkyvm!
 

Player_One

Member
OP
Newcomer
Joined
Aug 9, 2019
Messages
12
Trophies
0
Age
35
XP
261
Country
Russia
This helpful tip didn't actually remove those .whatever files. Tried twice, too :\
I added a command that undoes Spotlight indexing on macOS for the selected drive. And it seems to have worked. Please check with yourself switchSD v0.3.3.
 

sorabora

Well-Known Member
Member
Joined
Dec 8, 2016
Messages
368
Trophies
0
XP
1,476
Country
United States
Oddly enough, those macOS files do not show in Tinfoil-like apps or in NX Shell. SO I think it worked.

They do show up, however, in Goldleaf .73 No idea what's going on.

Image attached is re: nca button error. Got it both times I tried that option. About 50% or so of the way through.
 

Attachments

  • Screen Shot 2019-10-05 at 10.39.35 AM.png
    Screen Shot 2019-10-05 at 10.39.35 AM.png
    116.4 KB · Views: 591
Last edited by sorabora,

Player_One

Member
OP
Newcomer
Joined
Aug 9, 2019
Messages
12
Trophies
0
Age
35
XP
261
Country
Russia
Oddly enough, those macOS files do not show in Tinfoil-like apps or in NX Shell. SO I think it worked.

They do show up, however, in Goldleaf .73 No idea what's going on.

Image attached is re: nca button error. Got it both times I tried that option. About 50% or so of the way through.
I will check Goldleaft, I tested only in NX-Shell.
This is not a problem, the script could not unmount the usb disk, I will add a handler for this case. drag the flash drive and restart the script the error should disappear. Thanks)
 
  • Like
Reactions: sorabora

iNash

Member
Newcomer
Joined
Jul 27, 2018
Messages
6
Trophies
0
Age
41
XP
107
Country
Kuwait
hello its gives me that msg
find: /Volumes/switch/.Trashes: Operation not permitted

find: /Volumes/switch/.Spotlight-V100: Operation not permitted


find: /Volumes/switch/.Trashes: Operation not permitted

find: /Volumes/switch/.Spotlight-V100: Operation not permitted (1)

Mac Os Catalina
 

wiewiec

Well-Known Member
Member
Joined
Dec 24, 2015
Messages
774
Trophies
0
Age
39
Location
Somewhere
XP
1,373
Country
Poland

Info:
Mac OS users are having trouble reading an SD card on the Nintendo Switch. This is all because the archive file attribute of HOS (Nintendo Switch OS) and macOS are used for different purposes.
I wrote a small application (applescript) that removes archive attributes for all files and folders on the Switch SD card.
It also takes into account the specificity of .nca folders and fixed them.
And lastly, it cleans up hidden unnecessary files for the Switch that macOS created when you worked with SD through the Finder.
In the new version, you can choose where you want to fix the attributes. On the entire map except the Nintendo folders on it (so as not to violate the attributes of the nca folders)
or you can fix the attributes of the Nintendo folders(if something is wrong with .nca attributes).

How to use:
1. Perform all the actions you need with the files and folders on the switch SD card.

2. Select the name of the SD card from the list.
View attachment 179649
3. Select a direction to fix:
View attachment 178397
(a) Fix bit all files - will remove the archive bit for all files and folders on SD except Nintendo folders.
(b) Fix bit Nintendo folders - restore archive bit for all .nca on SD card.

4. Enter the administrator password.
View attachment 175936

5. (a) Fix bit all files - the process is pretty fast
View attachment 178396
5. (b) Fix bit Nintendo folders - This process is not fast and depends on the number of .nca on the SD card.
View attachment 177315

6. Wait for notification of the end of the processes.

Done - Insert the SD card into the Switch.
View attachment 175934

Note:
You may need to allow applications not installed by Apple developers to be launched.
To do this, run the command in Terminal " sudo spctl --master-disable "
View attachment 175959


Code:
#switchSD v0.3.3

#by PlayerOne


property rm : "sudo rm -rf "

property arch : "sudo chflags -R arch "


set disksExternal to do shell script "mount | awk '/Volumes/ { print $3 }'"

set diskExternal to every paragraph of disksExternal


choose from list diskExternal with prompt "Select SD card for Nintendo Switch"

set the switchSD to the result

if switchSD is equal to false then return

set switchSD to quoted form of POSIX path of (switchSD as string)


set Fix to button returned of (display dialog "What do you want to fix?" buttons {"Fix bit Nintendo folders", "Fix bit all files"})


do shell script "find " & switchSD & " -name '._*' -delete"

do shell script "find " & switchSD & " -name '.DS_Store' -delete"


if Fix is "Fix bit all files" then

    set bitArchFiles to do shell script "find " & switchSD & "/* -path " & switchSD & " -prune -o -path " & switchSD & "/emuMMC -prune -o -path " & switchSD & "/Nintendo -prune -o -depth 0 -print"

    set archFiles to every paragraph of bitArchFiles

 

    set ProgressDialog to length of archFiles

    set progress total steps to ProgressDialog

    set progress completed steps to 0

    set progress description to "Fix bit all"

    set progress additional description to ""

 

    repeat with bit from 1 to length of archFiles

        set archBit to item bit of archFiles

        set progress additional description to POSIX path of archBit

        do shell script "sudo chflags -R arch " & quoted form of archBit with administrator privileges

        set progress completed steps to bit

    end repeat

end if



if Fix is "Fix bit Nintendo folders" then

    set listNCAs to do shell script "find " & switchSD & "/ -name '*.nca' | grep .nca"

    set NCAs to every paragraph of listNCAs

 

    set ProgressDialog to length of NCAs

    set progress total steps to ProgressDialog

    set progress completed steps to 0

    set progress description to "Fix bit NCA folders"

    set progress additional description to ""

 

    repeat with a from 1 to length of NCAs

        set nca to item a of NCAs

        set progress additional description to POSIX path of nca

        set ncaF to do shell script "echo " & quoted form of nca & " | cut -d'.' -f-1"

        do shell script "mkdir " & quoted form of ncaF with administrator privileges

        do shell script "mv " & quoted form of nca & "/* " & quoted form of ncaF with administrator privileges

        do shell script rm & quoted form of nca with administrator privileges

        do shell script "mv " & quoted form of ncaF & " " & quoted form of (ncaF & ".nca") with administrator privileges

        set progress completed steps to a

    end repeat

end if


set progress total steps to 0

set progress completed steps to 0


do shell script "sudo touch " & switchSD & " .metadata_never_index" with administrator privileges

do shell script "find " & switchSD & " -name '._*' -delete"

do shell script "find " & switchSD & " -name '.DS_Store' -delete"

do shell script rm & switchSD & ".Spotlight-V100" with administrator privileges

do shell script rm & switchSD & ".fseventsd" with administrator privileges

do shell script rm & switchSD & ".Trashes" with administrator privileges


set progress description to "Unmount SD card"

set progress additional description to (switchSD as string)

do shell script "sudo diskutil unmount " & switchSD with administrator privileges

do shell script "afplay /System/Library/Sounds/Glass.aiff"

display notification "SwitchSD- Done" with icon


set progress description to ""

set progress additional description to ""

Version:

switchSD - v0.1
- the script works

switchSD - v0.2
- Added a progress bar to observe the process.

switchSD - v0.3
- The path selection for SD is changed, now the script checks external disks and displays the names.
- Separation of functions on fix bit for everything except .nca and fix bit .nca folders.
- Fixed the work of paths if the disc name contains spaces.

switchSD - v0.3.1
- Fixed bug bit archive for emuMMC folder.

switchSD - v0.3.2
- Changed drive search, now search all drives. The drive name must not contain spaces.

switchSD - v0.3.3
- add touch command .metadata_never_index (fix delete .Spotlight-V100 folder)

I have question if you have plans to update app to handle Catalina, because it is not working correctly and returns errors when I try clean SD. Thanks
 

KingRaijun

Member
Newcomer
Joined
Apr 18, 2020
Messages
8
Trophies
0
Age
34
XP
59
Country
Philippines
I use an alternative solution for this since I'm using Mojave.

`sudo chflags -R arch <directory>` (!!!!!) EXCEPT (!!!!!) Nintendo folder of course.

But the tool works most of the time if I delete the Spotlight file.
 

bao3

Active Member
Newcomer
Joined
Oct 27, 2019
Messages
33
Trophies
0
Age
41
Website
www.vultr.com
XP
258
Country
China

Info:
Mac OS users are having trouble reading an SD card on the Nintendo Switch. This is all because the archive file attribute of HOS (Nintendo Switch OS) and macOS are used for different purposes.
I wrote a small application (applescript) that removes archive attributes for all files and folders on the Switch SD card.
It also takes into account the specificity of .nca folders and fixed them.
And lastly, it cleans up hidden unnecessary files for the Switch that macOS created when you worked with SD through the Finder.
In the new version, you can choose where you want to fix the attributes. On the entire map except the Nintendo folders on it (so as not to violate the attributes of the nca folders)
or you can fix the attributes of the Nintendo folders(if something is wrong with .nca attributes).

How to use:
1. Perform all the actions you need with the files and folders on the switch SD card.

2. Select the name of the SD card from the list.
View attachment 179649
3. Select a direction to fix:
View attachment 178397
(a) Fix bit all files - will remove the archive bit for all files and folders on SD except Nintendo folders.
(b) Fix bit Nintendo folders - restore archive bit for all .nca on SD card.

4. Enter the administrator password.
View attachment 175936

5. (a) Fix bit all files - the process is pretty fast
View attachment 178396
5. (b) Fix bit Nintendo folders - This process is not fast and depends on the number of .nca on the SD card.
View attachment 177315

6. Wait for notification of the end of the processes.

Done - Insert the SD card into the Switch.
View attachment 175934

Note:
You may need to allow applications not installed by Apple developers to be launched.
To do this, run the command in Terminal " sudo spctl --master-disable "
View attachment 175959


Code:
#switchSD v0.3.3

#by PlayerOne


property rm : "sudo rm -rf "

property arch : "sudo chflags -R arch "


set disksExternal to do shell script "mount | awk '/Volumes/ { print $3 }'"

set diskExternal to every paragraph of disksExternal


choose from list diskExternal with prompt "Select SD card for Nintendo Switch"

set the switchSD to the result

if switchSD is equal to false then return

set switchSD to quoted form of POSIX path of (switchSD as string)


set Fix to button returned of (display dialog "What do you want to fix?" buttons {"Fix bit Nintendo folders", "Fix bit all files"})


do shell script "find " & switchSD & " -name '._*' -delete"

do shell script "find " & switchSD & " -name '.DS_Store' -delete"


if Fix is "Fix bit all files" then

    set bitArchFiles to do shell script "find " & switchSD & "/* -path " & switchSD & " -prune -o -path " & switchSD & "/emuMMC -prune -o -path " & switchSD & "/Nintendo -prune -o -depth 0 -print"

    set archFiles to every paragraph of bitArchFiles

 

    set ProgressDialog to length of archFiles

    set progress total steps to ProgressDialog

    set progress completed steps to 0

    set progress description to "Fix bit all"

    set progress additional description to ""

 

    repeat with bit from 1 to length of archFiles

        set archBit to item bit of archFiles

        set progress additional description to POSIX path of archBit

        do shell script "sudo chflags -R arch " & quoted form of archBit with administrator privileges

        set progress completed steps to bit

    end repeat

end if



if Fix is "Fix bit Nintendo folders" then

    set listNCAs to do shell script "find " & switchSD & "/ -name '*.nca' | grep .nca"

    set NCAs to every paragraph of listNCAs

 

    set ProgressDialog to length of NCAs

    set progress total steps to ProgressDialog

    set progress completed steps to 0

    set progress description to "Fix bit NCA folders"

    set progress additional description to ""

 

    repeat with a from 1 to length of NCAs

        set nca to item a of NCAs

        set progress additional description to POSIX path of nca

        set ncaF to do shell script "echo " & quoted form of nca & " | cut -d'.' -f-1"

        do shell script "mkdir " & quoted form of ncaF with administrator privileges

        do shell script "mv " & quoted form of nca & "/* " & quoted form of ncaF with administrator privileges

        do shell script rm & quoted form of nca with administrator privileges

        do shell script "mv " & quoted form of ncaF & " " & quoted form of (ncaF & ".nca") with administrator privileges

        set progress completed steps to a

    end repeat

end if


set progress total steps to 0

set progress completed steps to 0


do shell script "sudo touch " & switchSD & " .metadata_never_index" with administrator privileges

do shell script "find " & switchSD & " -name '._*' -delete"

do shell script "find " & switchSD & " -name '.DS_Store' -delete"

do shell script rm & switchSD & ".Spotlight-V100" with administrator privileges

do shell script rm & switchSD & ".fseventsd" with administrator privileges

do shell script rm & switchSD & ".Trashes" with administrator privileges


set progress description to "Unmount SD card"

set progress additional description to (switchSD as string)

do shell script "sudo diskutil unmount " & switchSD with administrator privileges

do shell script "afplay /System/Library/Sounds/Glass.aiff"

display notification "SwitchSD- Done" with icon


set progress description to ""

set progress additional description to ""

Version:

switchSD - v0.1
- the script works

switchSD - v0.2
- Added a progress bar to observe the process.

switchSD - v0.3
- The path selection for SD is changed, now the script checks external disks and displays the names.
- Separation of functions on fix bit for everything except .nca and fix bit .nca folders.
- Fixed the work of paths if the disc name contains spaces.

switchSD - v0.3.1
- Fixed bug bit archive for emuMMC folder.

switchSD - v0.3.2
- Changed drive search, now search all drives. The drive name must not contain spaces.

switchSD - v0.3.3
- add touch command .metadata_never_index (fix delete .Spotlight-V100 folder)

It post errors on my macOS 15.5 ,


chflags: /Volumes/Untitled/EmuMMC: Operation not permitted




upload_2020-4-20_14-50-9.png
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Sicklyboy @ Sicklyboy:
    maaaaan that's so awesome but I also don't want to fork over a hundo for it
  • Veho @ Veho:
    The fuuuuu---
  • Veho @ Veho:
    I thought it was an actual xBox at that price.
  • Sicklyboy @ Sicklyboy:
    I wanna grab a 360 Slim and a 360 E one of these days. Missed the boat of getting them at their lowest though, once they were discontinued. Could've got them for cheap back when I was a broke 20 something working at Target, but then again, I was a broke 20 something working at Target
  • Veho @ Veho:
    Being broke is no fun.
  • K3Nv2 @ K3Nv2:
    @Sicklyboy, $150 isn't that bad for a jtag slim on ebay
  • Veho @ Veho:
    I only wish it was actually playable.
  • Veho @ Veho:
    There's a guy on the Tube of You that makes playable mechanical arcade games out of Lego. This could work on the same principle.
  • Veho @ Veho:
    Just a couple of guys taking their manatee out for some fresh air, why you have to molest them?
  • Veho @ Veho:
    Stupid Chinese shop switched their shipping company and this one is slooooooow.
  • LeoTCK @ LeoTCK:
    STOP BUYING CHINESE CRAP THEN
  • LeoTCK @ LeoTCK:
    SUPPORT LOCAL PRODUCTS, MAKE REVOLUTION
  • LeoTCK @ LeoTCK:
    THEY KEEP REMOVING LOCAL SHIt AND REPLACING WItH INFERIOR CHINESE CRAP
  • LeoTCK @ LeoTCK:
    THATS WHY MY PARTNER CANT GET A GOOTWEAR HIS SIZE ANYMORE
  • LeoTCK @ LeoTCK:
    HE HAS BIG FOOT AND BIG DUCK
  • LeoTCK @ LeoTCK:
    d*ck i mean*
  • LeoTCK @ LeoTCK:
    lol
  • Veho @ Veho:
    Mkay.
  • Veho @ Veho:
    I just ordered another package from China just to spite you.
  • SylverReZ @ SylverReZ:
    Leo could not withstand communism.
  • SylverReZ @ SylverReZ:
    Its OUR products to begin with lol.
    SylverReZ @ SylverReZ: Its OUR products to begin with lol.