# How to rename the local file?

**URL:** <https://discourse.nodered.org/t/how-to-rename-the-local-file/71348>\
**Category:** General\
**Created:** [28 November 2022 02:55 UTC](https://discourse.nodered.org/t/how-to-rename-the-local-file/71348 "2022-11-28T02:55:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ConquerAll7](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/conquerall7/32/68934_2.png) [@ConquerAll7](https://discourse.nodered.org/u/ConquerAll7)\
**Post date:** [28 November 2022 02:55 UTC](https://discourse.nodered.org/t/how-to-rename-the-local-file/71348/1 "2022-11-28T02:55:45Z")

</div>

I want to rename a local file. And I try to use "fs-ops-move" node but it shows that permission denied.

 ![截屏2022-11-28 上午10.50.56](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae1db86a548c81f6ae9ce31602a5a73e1f860d82.png)  
Is there any other way to rename the local file? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 November 2022 07:18 UTC](https://discourse.nodered.org/t/how-to-rename-the-local-file/71348/2 "2022-11-28T07:18:52Z")

</div>

What OS is node red running on?  
If you login as that user can you rename the file?  
What file is it?

---

<div class="post-metadata">

**Author:** ![ConquerAll7](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/conquerall7/32/68934_2.png) [@ConquerAll7](https://discourse.nodered.org/u/ConquerAll7)\
**Post date:** [30 November 2022 07:26 UTC](https://discourse.nodered.org/t/how-to-rename-the-local-file/71348/3 "2022-11-30T07:26:41Z")

</div>

I run node-red on Linux.  
And I just want to add the suffix ".mp4" at the end of the file name to change the file type.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 November 2022 07:46 UTC](https://discourse.nodered.org/t/how-to-rename-the-local-file/71348/4 "2022-11-30T07:46:05Z")

</div>

If you want help you must try and answer the questions asked. I will try again, in a different way.

Login as the user that runs node red and rename the file using the command line. Copy/paste the result, including the line where you enter the command.

Also show us how you have configured the node and show us the message you are sending to the node to do the rename.

A thought, though. I assume that you are providing the full path to the file. If not then do that.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [30 November 2022 10:00 UTC](https://discourse.nodered.org/t/how-to-rename-the-local-file/71348/5 "2022-11-30T10:00:54Z")

</div>

The most likely cause of permission denied is that the Node-red user does not have write permission to the target directory.

```auto
ls -ld /etc
drwxr-xr-x 109 root root 12288 Nov 28 11:00 /etc
cd /etc
mv /home/pi/testfile try.mp4
mv: cannot move '/home/pi/testfile' to 'testfile.mp4': Permission denied

```

Make certain that you are targetting the right directory by using full pathnames.

```auto
cd /etc
mv /home/pi/testfile /home/pi/testfile.mp4
echo $?
0 # Success

```

> [@ConquerAll7](#):
>
> Is there any other way to rename the local file?

You could use an exec node **sudo mv /full/path/to/testfile /full/path/to/testfile.mp4** but probably end up with an mp4 file that you can't access.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 January 2023 10:01 UTC](https://discourse.nodered.org/t/how-to-rename-the-local-file/71348/6 "2023-01-29T10:01:16Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
