Finding and removing large files on iPhone

Imported from the WayBack machine: https://web.archive.org/web/20140418084035/https://www.johndball.com/2012/05/08/finding-and-removing-large-files-on-iphone/

Finding and removing large files on iPhone
Posted on May 8, 2012 by johndball

I recently had an issue in which a movie partially downloaded to my iPhone. For some reason the download failed but, instead of picking up where the partially downloaded file left off, my iPhone started downloading the same movie twice. I was left with about 1.6 GB of junk that I couldnā€™t remove automatically (iTunes purge, resume downloads, etc). This data was showing in iTunes as ā€œOther Dataā€. This is a good time to note that ā€œother dataā€ doesnā€™t mean all junk; it is other data not categorized by the limited categories displayed in iTunes.

Having previously jailbroken my iPhone 4S running iOS 5.0.1, I knew I had the tools available to me to delete the junk files but still had no way of searching for files by size (those tools: mobile terminal for iOS 5 and ifile). Then I stumbled across this website: https://forums.macrumors.com/showthread.php?t=1000943

Following the instructions, I installed ā€œGawkā€ from Cydia then used the SSH terminal in iFunBox. (I had forgotten my SSH password since the last time I SSHā€™d into my iPhone, that took an additional 30 minutes to research, figure out, and correct. I wonā€™t go into the details but you can find everything you need to reset a forgotten SSH password here: https://www.hackint0sh.org/general-127/tutorial-change-iphone-root-password-if-youve-forgotten-79608.htm and here: https://www.functions-online.com/crypt.html )

Once I had my SSH password reset and Gawk installed, I SSHā€™d into my phone using iFunbox and ran this command:

find / -iname ā€œ*ā€ -ls | sort -rn -k 7.1 | gawk ā€˜{print $7,$11}ā€™ > files.txt
(copy/paste the above line into notepad to determine spaces between characters)

This created a text file called ā€œfiles.txtā€ in the folder /private/var/root/. Contained within the text file was largest to smallest files sorted from top to bottom.

I copied the text file to my laptop and opened it in notepad. Once opened, the very first file listed was the target file: ~1.6 GB located in /private/var/mobile/library/ifile/trash/var/mobile/media/purchases/(garbage file). I nuked this file and reclaimed my precious 1.6 GB of free space.

Leave a Reply

Your email address will not be published. Required fields are marked *