Cli-microsoft365: New command: spo file rename

Created on 18 Aug 2020  Â·  8Comments  Â·  Source: pnp/cli-microsoft365

Usage

spo file rename [options]

Description

Renames a file

Options

| Option | Description |
| ----------------------- | ----------------------------------------- |
-u, --webUrl <webUrl> | The URL of the site where the file is located
-s, --sourceUrl <sourceUrl> | Site-relative URL of the file to rename
-t, --targetFilename <targetFilename> | New Filename for the file to be renamed
--force | If a file already exists at the targetUrl, it will be moved to the recycle bin. If omitted, the move operation will be canceled if the file already exists at the targetUrl location

Additional Information

This could also be done with "spo file copy" if the
-t, --targetUrl | Server-relative URL where to copy the file
could include a new filename.

feature request good first issue work in progress

Most helpful comment

I am ready to take this one, please assign to me if possible

All 8 comments

Nice suggestion! How about we rename deleteIfAlreadyExists to force since deleteIfAlreadyExists in the context of a rename operation sounds confusing?

Sure! The only think is what if you are trying to rename a.doc to b.doc, and b.doc already exists?

My guess (in the context of a CLI) is that the operation should fail, unless a flag is set, in which case, the operator is renaming the file to b.doc, knowing there's a possibility that b.doc already exists and expecting this new file to supercede all others.

The command should work exactly like you mentioned: if there is a file with the new name already and force was not specified, the command should fail. So the only change I'm proposing is using force instead of deleteIfAlreadyExists. Other than that we should follow your initial spec. Makes sense?

Makes sense?

Ah, yes. Perfect!

Hey @Chuckler22, sorry for dropping the ball on your proposal. Would you like to give it a try and implement it?

Hello!

I'm sorry to be the guy who requests/suggests a feature, and then gets a
new job where they don't do the thing that they used to do, but I guess I
am that guy.

Best of luck with the project!

Regards

Dean

On Sat, 2 Jan 2021 at 21:20, Waldek Mastykarz notifications@github.com
wrote:

Hey @Chuckler22 https://github.com/Chuckler22, sorry for dropping the
ball on your proposal. Would you like to give it a try and implement it?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pnp/cli-microsoft365/issues/1763#issuecomment-753461631,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AQUXJW4N7UMGNNA2QJ3LFPLSX36PHANCNFSM4QCMLF3A
.

Life happens! No worries and thanks for your suggestion either way. I'm sure it will help others.

Good luck with the new job!

I am ready to take this one, please assign to me if possible

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vineet2907 picture vineet2907  Â·  3Comments

garrytrinder picture garrytrinder  Â·  3Comments

waldekmastykarz picture waldekmastykarz  Â·  3Comments

waldekmastykarz picture waldekmastykarz  Â·  3Comments

StfBauer picture StfBauer  Â·  3Comments