SHARE
TWEET

Clean Android Studio project folder

ulfben Jul 10th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ::Cleans an Android Studio project folder to prepare for archiving or sharing
  2. ::Based on the work of Daniel Fowler:
  3. ::  http://tekeye.uk/android/export-android-studio-project
  4.  
  5. @ECHO off
  6. @for /f %%a in ('2^>nul dir "%FOLDER%" /a-d/b/-o/-p/s^|find /v /c ""') do set n=%%a
  7. ECHO %n% files in project folder. Cleaning...
  8.  
  9. ::Removing Gradle code, it's added back in on import
  10. rmdir .gradle /s /q
  11. ::Removing IDE files
  12. rmdir .idea /s /q
  13. @del *.iml /f /s
  14. @del local.properties
  15. ::Removing build folders, will be recreated
  16. rmdir build /s /q
  17. rmdir app\build /s /q
  18. ::Removing Gradle Wrapper, will be added back in on import
  19. rmdir gradle /s /q
  20. ::Removing git ignore files
  21. ::del .gitignore /f /s
  22. ::Removing other Gradle files
  23. @del gradle.properties
  24. @del gradle?.*
  25. ::Remove libs folder
  26. ::rmdir app\libs /s /q
  27. ::Remove ProGuard rules
  28. ::del app\proguard-rules.pro /f
  29. ::Remove test code
  30. rmdir app\src\androidTest /s /q
  31. rmdir app\src\test /s /q
  32. ::Clear Read-only attributes
  33. attrib -R *.* /s
  34.  
  35.  
  36. @for /f %%a in ('2^>nul dir "%FOLDER%" /a-d/b/-o/-p/s^|find /v /c ""') do set n=%%a
  37. ECHO Done!
  38. ECHO %n% files remaining.
  39. PAUSE
RAW Paste Data
Top