0

I was checking out the size of my current sfdx project, and found that it was taking up nearly a third of a gigabyte. So I took a look at the individual folders and found that about half of that was the scratch org references in .sfdx/orgs, which has 235 folders. Each one is pretty small, but with so many it adds up. Some of them are from months ago, and so have certainly expired. Most of the rest aren't used any more.

Can I safely remove the orgs that I'm not currently using and does sfdx have a command to remove, for example, any of the orgs that I don't currently have an alias for? Or just any that wouldn't show up after sfdx force:org:list?

An answer below suggested running sfdx force:org:list --clean, which the documentation says will "remove all local org authorizations for non-active orgs," although I'm not exactly sure what that means. I did so with six currently aliased orgs and no orgs without an alias, and the commend had this output:

sfdx force:org:list --clean
Found (5) org configurations to delete. Are you sure (yes/no)?: yes
=== Orgs
  ALIAS  USERNAME                   ORG ID              CONNECTED STATUS
  ─────  ─────────────────────────  ──────────────────  ────────────────
         chuck.ross@...

     ALIAS                    USERNAME                       ORG ID              EXPIRATION DATE
───  ───────────────────────  ─────────────────────────────  ──────────────────  ───────────────
     core-modal-dialog-jtest  ...
     dev                      ...
     dev-tabs                 ...
     lo-search-view           ...
(U)  lo-search-view-2         ...
     soc                      ...

No orgs were removed and all 235 folders were still in .sfdx/orgs.

1 Answer 1

3

Use sfdx force:org:list --clean to clear out your expired org data.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .