[XAP][SOURCE] Storage Cleaner 0.2.1

Search This thread

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,932
Seattle
Hi folks!

So, inspired by the discoveries on this thread, I set about creating an app to easily discover and delete space-wasting files. This app is now in Alpha stage, and will be advanced to Beta as soon as it is feature-complete.

Requirements: capability-unlock (interop-unlock plus EnableAllSideloading). In the case of files that can't be deleted normally, the app will attempt to use the Samsung-specific RPC Component to move them to the SD card (and delete them from there). The app will still run on non-Samsung phones, or those without SD cards (although you'll get a warning at launch in either case) provided they meet the other requirements, but some folders won't be cleanable.

Current state: Alpha 0.2.1
History:
Alpha 0.2.1: Files will now be checked for the Read-Only flag, and it will be removed if possible, both before attempting an in-place deletion and after moving to SD. In case of an error, the exception type will now be given in the report. Files with a "Modified" date in the future will now be included by default as well.
Alpha 0.2.0: Added Move-to-SD-and-then-delete as a work-around to permissions issues. Added warnings if Samsung RPCComponent or SD card are not present. Truncated overly-long messageboxes to avoid the app hanging for a few minutes due to an accidental tap. Re-compiled as release build for performance.
Initial release (20 Feb 2014)

Source code is available at https://wp8storagecleanup.codeplex.com/

Please post feedback here!
 

Attachments

  • StorageCleanup_Debug_AnyCPU.xap
    48.2 KB · Views: 1,506
  • StorageCleanup_0_2_0.xap
    122.7 KB · Views: 865
  • StorageCleanup_0_2_1.xap
    122.9 KB · Views: 6,130
Last edited:

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,932
Seattle
Known issues:
  • Many locations that we nominally have access to don't actually grant *delete* access, only read and write/create (yes, NT tracks permissions for Delete separately from Write). Thus, a lot of files that you'd like to delete might not actually go away. (Sadly, this includes the EdmCache\Lib folder mentioned in the thread linked above). I'm working on it!
    Should be fixed as of 0.2.0, if you have a Samsung phone and an SD card!
  • Many locations set the Read-Only flag on their files, making them un-deletable even with move-to-SD.
    Should be fixed as of 0.2.1, which removes RO flags either in-place or acter move-to-SD
  • The app startup is pretty slow. Well, it's actually fairly fast, but it seems slow because the entire structures of all relevant directories are traversed before the UI is shown. I will move that to a background/async thread "soon".
  • Viewing the files for some locations (like the TIF folders, which often have hundreds or thousands of files) will cause the app to hang for a long time while it tries to format kilobytes of text into a MessageBox.
    As of 0.2.0 this problem should no longer occur, as the messages will be truncated before being displayed in the MessageBox.
  • There's no way to change the list of locations. Well, not short of re-compiling the app, at least. I'll move them to external storage soon.

Features I want to implement:
  • Filtering (especially for specific folders) to files older than a certain date. This is actually already supported by the app; there's just no UI for it.
  • Adding additional locations for cleaning out files from, and removing locations too. Ideally, these would persist across runs of the app.
  • One button to select (or clear) all locations.
  • Option to hide locations which have no files of interest (just to make the list smaller).
  • Ability to edit a given location's filters (filtering on filename patterns is already implemented, but again, there's no UI for it). This should persist too.
  • At some point, the ability to select (or de-select) specific files or folders for deletion, in case the filtering isn't fine-grained enough. This is pretty easy to add; I just hate writing XAML.
  • While I'm at it, the ability to delete directories might be good. Currently this tool only deletes files.
  • More detailed errors when deleting a file fails. It's *usually* ERROR_ACCESS_DENIED, but it could be something else (like the file being in use by another program).
  • An option to move files to the SD card instead of deleting them. This would save space while providing the ability to implement an un-delete. True un-delete would require some kind of log or structure to the moved files.
  • Speaking of logs, I really should have the app generate one. Again, the basic stuff is already there; in fact, it generates *too much* text, so much so that I had to make it truncate MessageBox contents at about a KB.
  • Option to report file sizes in units based on powers of 1000 or powers of 1024 (currently it uses powers of 1000).
  • Internationalization would be good.
  • Possibly, at some point in the future, the ability to check (and clean out) the storage of other apps. You can clean them by just removing (and re-installing) them, of course, but sometimes that's a pain, and a more specific filter may be good.
  • Possibly an in-app update notification when new versions come out...
 
Last edited:

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,932
Seattle
the RPCComponent doesn't actually change the file ACLs, and may even turn inherited ACLs into file-specific ones when used; I previously tried copying files from unreadable locations to System32, and was still unable to read them even though I could now see them and see their file size. Very irritating.

My work-around for that is to move them to the SD card, which (being a FAT file system) has no ACLs at all. They can then be deleted from there. This works great... if you have an SD card. While I imagine most Ativ S users have installed such a card (it's one of the best features of the Ativ S, the only first-gen WP8 device to both have good specs *and* a microSD card) and they're pretty cheap if not (only needs to be big enough to briefly store the file being moved; 4GB would be more than enough), it's annoying to introduce dependencies like that. Still you've gotta do what you've gotta do...
 

-W_O_L_F-

Senior Member
Jul 10, 2010
1,030
940
Moscow
the RPCComponent doesn't actually change the file ACLs, and may even turn inherited ACLs into file-specific ones when used; I previously tried copying files from unreadable locations to System32, and was still unable to read them even though I could now see them and see their file size. Very irritating.

My work-around for that is to move them to the SD card, which (being a FAT file system) has no ACLs at all. They can then be deleted from there. This works great... if you have an SD card. While I imagine most Ativ S users have installed such a card (it's one of the best features of the Ativ S, the only first-gen WP8 device to both have good specs *and* a microSD card) and they're pretty cheap if not (only needs to be big enough to briefly store the file being moved; 4GB would be more than enough), it's annoying to introduce dependencies like that. Still you've gotta do what you've gotta do...
Just make it an option ;)
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,932
Seattle
OK, I implemented the Move-to-SD-and-then-delete hack. It's considerably slower that in-place deletion but it works. I also built the app for Release (rather than debug) which improves initial performance somewhat, and truncated long messages so you don't have to watch the phone struggle to display a messagebox with 200KB of text.
 

Amirphp

Senior Member
Aug 21, 2011
147
31
Allahabad
installed on my lumia 520 with developer unlocked...Not able to open.
Deployed successfully....but no app icon in Application list....
How to launch it?
tell me?
 

lukas_ita

Senior Member
Sep 8, 2009
152
4
You need capabilities-unlock, it is not possible yet on Lumias. Only on Ativs


Sent from my GT-I8750 using Tapatalk
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,932
Seattle
installed on my lumia 520 with developer unlocked...Not able to open.
Deployed successfully....but no app icon in Application list....
How to launch it?
tell me?
If you actually managed to even get it installed, I'm impressed! It should have reported an error. This app uses both ID_CAP_INTEROPSERVICES and some capabilities that installable apps aren't supposed to have at all. There should have been at least two different errors if you tried to install it on a Lumia...
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,932
Seattle
@trytogetme: Are you using the newer version, and do you have an SD card in the phone (with at least a bit of space; it doesn't need much)?

If so, I'll try to dig deeper into what the problem could be. @error0x0000034 has a good point, though; you may want to try running the app immediately after rebooting the phone.
 

trytogetme

Senior Member
Dec 11, 2012
64
8
Realme GT
@trytogetme: Are you using the newer version, and do you have an SD card in the phone (with at least a bit of space; it doesn't need much)?

If so, I'll try to dig deeper into what the problem could be. @error0x0000034 has a good point, though; you may want to try running the app immediately after rebooting the phone.

Restarting the phone doesnt help for me.
Still the error. The app doesnt care what folder I want to clear. Got that error every time:(
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,932
Seattle
Hmm. I'll see if there's something I can do about that. One thing I found is that some files are marked Read-Only. Unlike proper ACLs, that flag persists after the move to microSD. It's easy to remove, though. I'll add code to check for, and remove, that flag.

Can you connect your phone to USB and check the SD card? If there's a folder called "StorageCleanerTemp" on the root of the SD card, that means there were files moved by the PRCComponent but which the app subsequently failed to delete. The most likely reason is that they were flagged as Read Only. (it's worth noting that this would have removed them from the phone's internal storage anyhow...)

I just deleted my Temporary Internet Files using v0.2.0, exactly the same as you can get here. It took something like 10 minutes - I really need to optimize that - but it worked, deleting some 2600 files totaling over 200MB.
 

Amirphp

Senior Member
Aug 21, 2011
147
31
Allahabad
If you actually managed to even get it installed, I'm impressed! It should have reported an error. This app uses both ID_CAP_INTEROPSERVICES and some capabilities that installable apps aren't supposed to have at all. There should have been at least two different errors if you tried to install it on a Lumia...
i used xap Deployer 2.0
And installed without any error...
But No app icon...as i told earlier.
But when i tried to deploy via windows Power Tools...then i got error...
But no error with Xap deployer 2.0.
 

dada.81

Senior Member
Sep 18, 2007
56
10
Are there any other folders or files that could be deleted to regain space from system files?
My system is at 9.59GB, but even the StorageCleanup says I can free up to 215.3MB only, with the Store app package cache holding only 1-2 .zmz files (with about 30MB, the most is in Temporary Internet files, at about 170MB)...
Each time I delete some apps I installed previously (just about 4GB of apps right now), pretty soon that free space gets "eaten up" by the system leaving me with just MB/KBs free?! :( It's unreal how Microsoft hasn't at least addressed this as a bug yet, maybe it's going to be fixed in 8.1, hopefully developer preview's coming soon... :confused:


@GoodDayToDie - I wanted to rebuild the xap myself and see if I could help out myself somehow, but I'm having a problem with deploying the app from VS2013 with the standalone WP8SDK installed, in particular with these capabilities:

<Capability Name="ID_CAP_CHAMBER_PROFILE_DATA_RW" />
<Capability Name="ID_CAP_COMMS_SERVICES" />
<Capability Name="ID_CAP_COMMS_APPLICATIONS" />
<Capability Name="ID_CAP_COMMS_COMMON" />
<Capability Name="ID_CAP_DU_SHARED_DATA" />
<Capability Name="ID_CAP_DUASVC" />
<Capability Name="ID_CAP_EDM_CACHE_WRITE" />
<Capability Name="ID_CAP_ENTERPRISE_SERVICE" />
<Capability Name="ID_CAP_PHONE_INTERNAL" />
<Capability Name="ID_CAP_PUBLIC_FOLDER_FULL" />
<Capability Name="ID_CAP_ZMFSERVICES" />

failing build with these 1 error + 10 warnings:
The 'Name' attribute is invalid - The value 'ID_CAP_CHAMBER_PROFILE_DATA_RW' is invalid according to its datatype 'String' - The Enumeration constraint failed, etc...

How do you get around it please? And is your CRPComponent free to use/distribute? I'd like to use some of its method calls (which I will share afterwards - hope you don't mind that I got it from the xap file - the dll&winmd files)...
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    Hi folks!

    So, inspired by the discoveries on this thread, I set about creating an app to easily discover and delete space-wasting files. This app is now in Alpha stage, and will be advanced to Beta as soon as it is feature-complete.

    Requirements: capability-unlock (interop-unlock plus EnableAllSideloading). In the case of files that can't be deleted normally, the app will attempt to use the Samsung-specific RPC Component to move them to the SD card (and delete them from there). The app will still run on non-Samsung phones, or those without SD cards (although you'll get a warning at launch in either case) provided they meet the other requirements, but some folders won't be cleanable.

    Current state: Alpha 0.2.1
    History:
    Alpha 0.2.1: Files will now be checked for the Read-Only flag, and it will be removed if possible, both before attempting an in-place deletion and after moving to SD. In case of an error, the exception type will now be given in the report. Files with a "Modified" date in the future will now be included by default as well.
    Alpha 0.2.0: Added Move-to-SD-and-then-delete as a work-around to permissions issues. Added warnings if Samsung RPCComponent or SD card are not present. Truncated overly-long messageboxes to avoid the app hanging for a few minutes due to an accidental tap. Re-compiled as release build for performance.
    Initial release (20 Feb 2014)

    Source code is available at https://wp8storagecleanup.codeplex.com/

    Please post feedback here!
    3
    Known issues:
    • Many locations that we nominally have access to don't actually grant *delete* access, only read and write/create (yes, NT tracks permissions for Delete separately from Write). Thus, a lot of files that you'd like to delete might not actually go away. (Sadly, this includes the EdmCache\Lib folder mentioned in the thread linked above). I'm working on it!
      Should be fixed as of 0.2.0, if you have a Samsung phone and an SD card!
    • Many locations set the Read-Only flag on their files, making them un-deletable even with move-to-SD.
      Should be fixed as of 0.2.1, which removes RO flags either in-place or acter move-to-SD
    • The app startup is pretty slow. Well, it's actually fairly fast, but it seems slow because the entire structures of all relevant directories are traversed before the UI is shown. I will move that to a background/async thread "soon".
    • Viewing the files for some locations (like the TIF folders, which often have hundreds or thousands of files) will cause the app to hang for a long time while it tries to format kilobytes of text into a MessageBox.
      As of 0.2.0 this problem should no longer occur, as the messages will be truncated before being displayed in the MessageBox.
    • There's no way to change the list of locations. Well, not short of re-compiling the app, at least. I'll move them to external storage soon.

    Features I want to implement:
    • Filtering (especially for specific folders) to files older than a certain date. This is actually already supported by the app; there's just no UI for it.
    • Adding additional locations for cleaning out files from, and removing locations too. Ideally, these would persist across runs of the app.
    • One button to select (or clear) all locations.
    • Option to hide locations which have no files of interest (just to make the list smaller).
    • Ability to edit a given location's filters (filtering on filename patterns is already implemented, but again, there's no UI for it). This should persist too.
    • At some point, the ability to select (or de-select) specific files or folders for deletion, in case the filtering isn't fine-grained enough. This is pretty easy to add; I just hate writing XAML.
    • While I'm at it, the ability to delete directories might be good. Currently this tool only deletes files.
    • More detailed errors when deleting a file fails. It's *usually* ERROR_ACCESS_DENIED, but it could be something else (like the file being in use by another program).
    • An option to move files to the SD card instead of deleting them. This would save space while providing the ability to implement an un-delete. True un-delete would require some kind of log or structure to the moved files.
    • Speaking of logs, I really should have the app generate one. Again, the basic stuff is already there; in fact, it generates *too much* text, so much so that I had to make it truncate MessageBox contents at about a KB.
    • Option to report file sizes in units based on powers of 1000 or powers of 1024 (currently it uses powers of 1000).
    • Internationalization would be good.
    • Possibly, at some point in the future, the ability to check (and clean out) the storage of other apps. You can clean them by just removing (and re-installing) them, of course, but sometimes that's a pain, and a more specific filter may be good.
    • Possibly an in-app update notification when new versions come out...
    2
    2
    Nokia has this option to move files .
    you can use the SilentInstaller of Nokia (in Extras + Info) to move files

    Nokia Silent Installer -> CsTileInstallerRuntime :
    [MethodImpl(0, MethodCodeType=MethodCodeType.Runtime)]
    public bool NRSCopyFile([In] string src, [In] string dst);

    That is very different thing than the Storage Cleaner Does.
    NDTK Server doesn't support for Move Files.
    Only CopyFiles, Copy .Provxml

    Well, @vcfan is working on Universal RPC Functionality with most of the Fully Functional API's.
    SUPPORT HIM for further Development.
    1
    Hack:
    Move "undeletable" files to directory, where you can delete them with RPC and delete.