1. Player_One

    OP Player_One Newbie
    Newcomer

    Joined:
    Aug 9, 2019
    Messages:
    8
    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.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)
     

    Attached Files:

    Last edited by Player_One, Oct 5, 2019
    Alsusee, metaljay, bao3 and 8 others like this.
  2. stick267

    stick267 GBAtemp Advanced Fan
    Member

    Joined:
    Dec 17, 2018
    Messages:
    598
    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.
     
  3. Player_One

    OP Player_One Newbie
    Newcomer

    Joined:
    Aug 9, 2019
    Messages:
    8
    Country:
    Russia
    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)
     
    sorabora and stick267 like this.
  4. preacherfox

    preacherfox Advanced Member
    Newcomer

    Joined:
    Oct 3, 2014
    Messages:
    56
    Country:
    United States
    Sounds like a great app, however I doesn't list my sd card.
     
  5. Player_One

    OP Player_One Newbie
    Newcomer

    Joined:
    Aug 9, 2019
    Messages:
    8
    Country:
    Russia
    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, Sep 17, 2019
  6. preacherfox

    preacherfox Advanced Member
    Newcomer

    Joined:
    Oct 3, 2014
    Messages:
    56
    Country:
    United States
    Works great now, thanks so much.
     
    Player_One likes this.
  7. Zer0Dragon

    Zer0Dragon Newbie
    Newcomer

    Joined:
    Mar 22, 2010
    Messages:
    1
    Country:
    United States
    Also note, you'll need to add SwitchSD to have full disk access in Security and Privacy or else you'll have a problem listing and deleting .spotlight-v100 File
     
    Player_One and sorabora like this.
  8. Player_One

    OP Player_One Newbie
    Newcomer

    Joined:
    Aug 9, 2019
    Messages:
    8
    Country:
    Russia
    Thanks, that's right. Added to note.
     
    Last edited by Player_One, Oct 4, 2019
  9. sorabora

    sorabora GBAtemp Regular
    Member

    Joined:
    Dec 8, 2016
    Messages:
    294
    Country:
    United States
    This helpful tip didn't actually remove those .whatever files. Tried twice, too :\
     
  10. Tumbleweed

    Tumbleweed Advanced Member
    Newcomer

    Joined:
    Jul 29, 2018
    Messages:
    64
    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!
     
  11. Player_One

    OP Player_One Newbie
    Newcomer

    Joined:
    Aug 9, 2019
    Messages:
    8
    Country:
    Russia
    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.
     
  12. sorabora

    sorabora GBAtemp Regular
    Member

    Joined:
    Dec 8, 2016
    Messages:
    294
    Country:
    United States
    Will do shortly and report back. Thanks for your work!

    Edit: see post below!
     
    Last edited by sorabora, Oct 5, 2019
  13. sorabora

    sorabora GBAtemp Regular
    Member

    Joined:
    Dec 8, 2016
    Messages:
    294
    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.
     

    Attached Files:

    Last edited by sorabora, Oct 5, 2019
  14. Player_One

    OP Player_One Newbie
    Newcomer

    Joined:
    Aug 9, 2019
    Messages:
    8
    Country:
    Russia
    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)
     
    sorabora likes this.
  15. iNash

    iNash Newbie
    Newcomer

    Joined:
    Jul 27, 2018
    Messages:
    6
    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
     
  16. wiewiec

    wiewiec GBAtemp Advanced Fan
    Member

    Joined:
    Dec 24, 2015
    Messages:
    760
    Country:
    Poland
    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
     
  17. camicortes

    camicortes Chochos
    Newcomer

    Joined:
    Sep 20, 2006
    Messages:
    23
    Country:
    Chile
    Thank you so much, incredible useful!
     
  18. KingRaijun

    KingRaijun Newbie
    Newcomer

    Joined:
    Apr 18, 2020
    Messages:
    9
    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.
     
  19. bao3

    bao3 Member
    Newcomer

    Joined:
    Oct 27, 2019
    Messages:
    32
    Country:
    China
    It post errors on my macOS 15.5 ,


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




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

    lordupload Newbie
    Newcomer

    Joined:
    May 7, 2020
    Messages:
    6
    Country:
    Germany
    Have the same problem. Dunno what to do
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - attributes, archive, switch