Occ command for user-migration-app?

Is there a occ command I can use to make a backup of user’s datas ( user-migration-format) , before deleting them. So that I can restore the few of them that will ask it ?

You need to install this app:

App-Id user_migration
App-Name User migration
Summary Migrate user data
Categories tools
Repository https://github.com/nextcloud/user_migration
Issue-Tracker Issues · nextcloud/user_migration · GitHub
Developer-Doc. User migration — Nextcloud latest Developer Manual latest documentation
App-Version 4.0.1
- NC min/max 27 / 27
App-Version 5.0.0
- NC min/max 28 / 28
Not-shipped (not included) App available in appstore
Appstore User migration - Apps - App Store - Nextcloud

That provides the occ commands

  user:export                            Export a user.
  user:import                            Import a user.

Much and good luck,

1 Like

Thanks, it works …
And is there an option forchoosing what we want to export, as in the migration config page. Here I should not export the user’s files, that are included by default in the export, and take most of the space.

Maybe my question was not so clear in english …
Is there an option for the previous occ command “user:export” so that user’s files are not included in the exported file ?

Didn’t you read the help? :face_with_raised_eyebrow:

user@box:~# occ user:export --help
  Export a user.

  user:export [options] [--] [<user> [<folder>]]

  user                   user to export
  folder                 local folder to export into

  -l, --list[=LIST]      List the available data types, pass --list=full to show more information [default: false]
      --output[=OUTPUT]  Output format (plain, json or json_pretty, default is plain) [default: "plain"]
  -t, --types=TYPES      Comma-separated list of data type ids, pass --types=none to only export base user data [default: false]
  -h, --help             Display help for the given command. When no command is given display help for the list command
  -q, --quiet            Do not output any message
  -V, --version          Display this application version
      --ansi|--no-ansi   Force (or disable --no-ansi) ANSI output
  -n, --no-interaction   Do not ask any interactive question
      --no-warnings      Skip global warnings, show command output only
  -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
user@box:~# occ user:export --list=full
 --------------------- ---------- ----------------------------------------------------------------------------------
  Name                  Id         Description
 --------------------- ---------- ----------------------------------------------------------------------------------
  Cospend               cospend    Cospend projects and user settings
  Calendar              calendar   Calendars including events, details and attendees
  Contacts              contacts   Contacts and groups
  Deleted files         trashbin   Deleted files and folders in the trash bin (may expire during export if you are
                                   low on storage space)
  Forms                 forms      Forms including questions and submissions
  Profile information   account    Profile picture, full name, email, phone number, address, website, Twitter, orga
                                   nisation, role, headline, biography, and whether your profile is enabled
  Files                 files      Files owned by you including versions, comments, collaborative tags, and favorit
                                   es (versions may expire during export if you are low on storage space)
 --------------------- ---------- ----------------------------------------------------------------------------------

That means that you must pass a comma separated list of types you want to export or “none” if you only want to export the basic user data.
Here an example where the Profile information ‘account’ (together with the basic user data, which are allways exported) from a user “Steph” is exported into a previous created folder “UserExport” in the space of user “admin”:

user@box:~# occ user:export --types=account Steph "/nc/dat/data/admin/files/UserExport/"
Exporting user information in user.json…
Exporting settings in settings.json…
Exporting versions in versions.json…
Exporting account information in settings/account.json…
Exporting profile config in settings/config.json…
Export saved in /nc/dat/data/admin/files/UserExport/Steph_2024-03-18_19-26-57.zip

After you did the export, you should scan the file, to add it to the filecache (to make it visible from within your cloud):

user@box:~# occ files:scan -p "/admin/files/UserExport/"
Starting scan for user 1 out of 1 (admin)
| Folders | Files | Errors | Elapsed time |
| 1       | 1     | 0      | 00:00:00     |

Much and good luck,

I did not found the help :roll_eyes:
I have no more time to deal with that in the few next weeks, Your answer will still be usefull :grinning:
After testing the commande for one user, I will also have to make a script for doing that for a list of users, a group, or a circle :innocent:
Thanks for your answers …