daily pastebin goal
36%
SHARE
TWEET

Clean Android Studio project folder

ulfben Jul 10th, 2017 (edited) 71 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. :: Save as "prepare-for-export.bat" and put the script in root of your project.
  5. :: Execute by double-clicking on the bat-file.
  6. @ECHO off
  7. @for /f %%a in ('2^>nul dir "%FOLDER%" /a-d/b/-o/-p/s^|find /v /c ""') do set n=%%a
  8. ECHO %n% files in project folder. Cleaning...
  9.  
  10. ::Removing Gradle code, it's added back in on import
  11. rmdir .gradle /s /q
  12. ::Removing IDE files
  13. rmdir .idea /s /q
  14. @del *.iml /f /s
  15. @del local.properties
  16. ::Removing build folders, will be recreated
  17. rmdir build /s /q
  18. rmdir app\build /s /q
  19. ::Removing Gradle Wrapper, will be added back in on import
  20. rmdir gradle /s /q
  21. ::Removing git ignore files
  22. ::del .gitignore /f /s
  23. ::Removing other Gradle files
  24. @del gradle.properties
  25. @del gradle?.*
  26. ::Remove libs folder
  27. ::rmdir app\libs /s /q
  28. ::Remove ProGuard rules
  29. ::del app\proguard-rules.pro /f
  30. ::Remove test code
  31. rmdir app\src\androidTest /s /q
  32. rmdir app\src\test /s /q
  33. ::Clear Read-only attributes
  34. attrib -R *.* /s
  35.  
  36.  
  37. @for /f %%a in ('2^>nul dir "%FOLDER%" /a-d/b/-o/-p/s^|find /v /c ""') do set n=%%a
  38. ECHO Done!
  39. ECHO %n% files remaining.
  40. PAUSE
RAW Paste Data
Top