Skip to content

Instantly share code, notes, and snippets.

@NWPlayer123
Created November 21, 2019 07:37
Show Gist options
  • Save NWPlayer123/cd9ff643401b4de90886d5bebaf7e1ef to your computer and use it in GitHub Desktop.
Save NWPlayer123/cd9ff643401b4de90886d5bebaf7e1ef to your computer and use it in GitHub Desktop.
download all Checkpoint save folders for a game
#change local_ip to whatever NX-Shell/other FTP homebrew says
#saves_folder can be changed to whatever, this is just Pokemon Shield
#only recurses one directory so you gotta select a specific game's folder
from ftplib import FTP
from os.path import exists
from os import mkdir
local_ip = "192.168.0.13"
saves_folder = "/switch/Checkpoint/saves/0x01008DB008C2C000 0x01008DB008C2C000/"
ftp = FTP() #create FTP object
ftp.connect(local_ip, 5000) #connect to Switch
ftp.cwd(saves_folder) #current working directory -> saves path
folder = []
ftp.retrlines("NLST", folder.append) #retrieve all "files" (/folders) in cwd
files = []
for entry in folder: #for each folder,
foldername = entry.split("/")[-1]
if not exists(foldername): #if doesn't exist (haven't grabbed)
mkdir(foldername) #make folder
ftp.cwd(entry) #go into folder
ftp.retrlines("NLST", files.append) #list all files
for entry2 in files: #download all files
filename = entry2.split("/")[-1]
with open("/".join([foldername, filename]), "wb") as lf:
ftp.retrbinary("RETR " + filename, lf.write)
ftp.cwd(saves_folder) #move back to "root" directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment