ulfben

Clean Android Studio project folder

Jul 10th, 2017 (edited)
568
0
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 ::keep the wrapper, to avoid gradle version mismatches.
  21. ::Removing git ignore files
  22. del .gitignore /f /s
  23. ::Remove libs folder
  24. rmdir app\libs /s /q
  25. ::Remove ProGuard rules
  26. del app\proguard-rules.pro /f
  27. ::Remove test code
  28. rmdir app\src\androidTest /s /q
  29. rmdir app\src\test /s /q
  30. ::Clear Read-only attributes
  31. attrib -R *.* /s
  32.  
  33.  
  34. @for /f %%a in ('2^>nul dir "%FOLDER%" /a-d/b/-o/-p/s^|find /v /c ""') do set n=%%a
  35. ECHO Done!
  36. ECHO %n% files remaining.
  37. PAUSE
Add Comment
Please, Sign In to add comment