# Move and Delete

**URL:** <https://forum.rclone.org/t/move-and-delete/29133>\
**Category:** Help and Support\
**Created:** [February 7, 2022, 12:14pm UTC](https://forum.rclone.org/t/move-and-delete/29133 "2022-02-07T12:14:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 12:14pm UTC](https://forum.rclone.org/t/move-and-delete/29133/1 "2022-02-07T12:14:07Z")

</div>

#### What is the problem you are having with rclone?

This is a pre-use question so I'm not having any problems thus far. I am wondering if it is possible to download a file from FTP to my local computer and if there's already a file in that folder on my local computer delete the excisting file(s) as well as delete the file on the server. For example, on my local computer I have example.docx and on the FTP there's example-john-edit.docx, I want rclone to be able to download example-john-edit.docx to my local computer and delete example.docx from my local computer as well delete example-john-edit.docx on the server.

Is that possible? I've seen there's a move command but didn't see anything as specific as my needs.

#### Run the command 'rclone version' and share the full output of the command.

N/A

#### Which cloud storage system are you using? (eg Google Drive)

FTP on a server

#### The command you were trying to run (eg `rclone copy /tmp remote:tmp`)

N/A

#### The rclone config contents with secrets removed.

N.A

#### A log from the command with the `-vv` flag

N/A

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [February 7, 2022, 12:51pm UTC](https://forum.rclone.org/t/move-and-delete/29133/2 "2022-02-07T12:51:38Z")

</div>

If you move from source to destination, it'll delete from the source and copy to the destination.

You can decide how you want to overwrite the destination. Generally, if the destination is different, it'll overwrite it. There are many parameters to tweak that behavior.

Easy enough to setup and test. Give it a try and see if it does what you want and if not, share what you did and what you want to happen and we can surely figure it out.

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 1:14pm UTC](https://forum.rclone.org/t/move-and-delete/29133/3 "2022-02-07T13:14:30Z")

</div>

> [@Animosity022](#):
>
> If you move from source to destination, it'll delete from the source and copy to the destination.

If I have it setup like the following... G:\Files\Documents\John\2022\ will it delete everything within the files folder or do I need to set something for it to not?

I'm new to all this so I need to research how to setup rclone as it's all command line and I've only used this sort of stuff with help/guides.

> [@Animosity022](#):
>
> Easy enough to setup and test. Give it a try and see if it does what you want and if not, share what you did and what you want to happen and we can surely figure it out.

I will see if I can set it up and test and see how I get on.

Thanks for your reply 🙂

---

<div class="post-metadata">

**Author:** ![Animosity022](https://forum.rclone.org/user_avatar/forum.rclone.org/animosity022/32/451_2.png) [@Animosity022](https://forum.rclone.org/u/Animosity022)\
**Post date:** [February 7, 2022, 1:22pm UTC](https://forum.rclone.org/t/move-and-delete/29133/4 "2022-02-07T13:22:03Z")

</div>

> [@matt3m](#):
>
> If I have it setup like the following... G:\Files\Documents\John\2022\ will it delete everything within the files folder or do I need to set something for it to not?

It depends on what you use.

You can move the whole folder.  
You can move one file.

There is a flag called --dry-run so you can test something (very good to use with a move or any destructive operation).

rclone move C:\Directory remote: would move the entire directory assuming "Directory" is actually a directory.

rclone move C:\Directory\afile.txt remote: would move one file.

Both of those can be tested with --dry-run

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 2:13pm UTC](https://forum.rclone.org/t/move-and-delete/29133/5 "2022-02-07T14:13:35Z")

</div>

Ah OK cool, I'll give it a try.

Just gotta figure out how to configure it.

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 3:23pm UTC](https://forum.rclone.org/t/move-and-delete/29133/6 "2022-02-07T15:23:32Z")

</div>

I have tried setting up rclone but not sure if I have done it correctly as I can't get anything to work.

Do I have to install rclone on my server rather than my local computer to get it to transfer files to my local computer as I am getting the following error...

> 2022/02/07 15:19:11 ERROR : Local file system at //?/C:/media/sdh1/matt3/test/hello.docx: error reading source root directory: directory not found

That directory doesn't exist on my local computer as that's the directory on the server.

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 7, 2022, 3:43pm UTC](https://forum.rclone.org/t/move-and-delete/29133/7 "2022-02-07T15:43:33Z")

</div>

if you want to run rclone on your `c:`, then need to install rclone on that computer.

about that error, add `-vv` to the command, run the command, post the output.  
enclose it with three backticks so it is formatted like this.

```auto
rclone version
rclone v1.57.0
- os/version: Microsoft Windows 10 Pro 2009 (64 bit)
- os/kernel: 10.0.22000.434 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.17.2
- go/linking: dynamic
- go/tags: cmount

```

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 3:52pm UTC](https://forum.rclone.org/t/move-and-delete/29133/8 "2022-02-07T15:52:02Z")

</div>

> [@asdffdsa](#):
>
> if you want to run rclone on your `c:`, then need to install rclone on that computer.

I have rclone installed on my computer and I'm trying to transfer files from the server to my computer.

> [@asdffdsa](#):
>
> about that error, add `-vv` to the command, run the command, post the output.  
> enclose it with three backticks so it is formatted like this.

Here's the output from the command.

```auto

2022/02/07 15:49:34 DEBUG : rclone: Version "v1.57.0" starting with parameters ["C:\\rclone\\rclone.exe" "move" "/media/sdh1/matt3/test/hello.docx" "E:\\" "-vv"]

2022/02/07 15:49:34 DEBUG : Creating backend with remote "/media/sdh1/matt3/test/hello.docx"

2022/02/07 15:49:34 DEBUG : Using config file from "C:\\Users\\Matt\\AppData\\Roaming\\rclone\\rclone.conf"

2022/02/07 15:49:34 DEBUG : fs cache: renaming cache item "/media/sdh1/matt3/test/hello.docx" to be canonical "//?/C:/media/sdh1/matt3/test/hello.docx"

2022/02/07 15:49:34 DEBUG : Creating backend with remote "E:\\"

2022/02/07 15:49:34 DEBUG : fs cache: renaming cache item "E:\\" to be canonical "//?/E:/"

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Using server-side directory move

2022/02/07 15:49:34 INFO : Local file system at //?/E:/: Server side directory move failed - fallback to file moves: can't copy directory - destination already exists

2022/02/07 15:49:34 ERROR : Local file system at //?/C:/media/sdh1/matt3/test/hello.docx: error reading source root directory: directory not found

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Waiting for checks to finish

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Waiting for transfers to finish

2022/02/07 15:49:34 ERROR : Attempt 1/3 failed with 1 errors and: directory not found

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Using server-side directory move

2022/02/07 15:49:34 INFO : Local file system at //?/E:/: Server side directory move failed - fallback to file moves: can't copy directory - destination already exists

2022/02/07 15:49:34 ERROR : Local file system at //?/C:/media/sdh1/matt3/test/hello.docx: error reading source root directory: directory not found

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Waiting for checks to finish

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Waiting for transfers to finish

2022/02/07 15:49:34 ERROR : Attempt 2/3 failed with 1 errors and: directory not found

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Using server-side directory move

2022/02/07 15:49:34 INFO : Local file system at //?/E:/: Server side directory move failed - fallback to file moves: can't copy directory - destination already exists

2022/02/07 15:49:34 ERROR : Local file system at //?/C:/media/sdh1/matt3/test/hello.docx: error reading source root directory: directory not found

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Waiting for checks to finish

2022/02/07 15:49:34 DEBUG : Local file system at //?/E:/: Waiting for transfers to finish

2022/02/07 15:49:34 ERROR : Attempt 3/3 failed with 1 errors and: directory not found

2022/02/07 15:49:34 INFO :

Transferred: 0 B / 0 B, -, 0 B/s, ETA -

Errors: 1 (retrying may help)

Elapsed time: 0.0s

2022/02/07 15:49:34 DEBUG : 2 go routines active

2022/02/07 15:49:34 Failed to move: directory not found

```

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 7, 2022, 3:56pm UTC](https://forum.rclone.org/t/move-and-delete/29133/9 "2022-02-07T15:56:54Z")

</div>

as per the error message,  
rclone think that `/media/sdh1/matt3/test/hello.docx"` is a directory relative to c:\

`renaming cache item "/media/sdh1/matt3/test/hello.docx" to be canonical "//?/C:/media/sdh1/matt3/test/hello.docx"`

on windows, don't you need to use a netshare  
`\\server\share`

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 4:10pm UTC](https://forum.rclone.org/t/move-and-delete/29133/10 "2022-02-07T16:10:24Z")

</div>

Forgive me for being stupid but I've not understood what you mean.

I'm not too sure why it's thinking it's relative to C:. I think I have setup the rclone config correctly. Is there anyway I can test to make sure?

Thanks

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 7, 2022, 4:14pm UTC](https://forum.rclone.org/t/move-and-delete/29133/11 "2022-02-07T16:14:13Z")

</div>

perhaps if you can explain, in detail, what you are trying to do with that command?

so are running rclone on a windows computer and want to move files to it from a linux server?

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 4:22pm UTC](https://forum.rclone.org/t/move-and-delete/29133/12 "2022-02-07T16:22:10Z")

</div>

I have installed rclone on my Windows computer so I can automatically download new files from a linux server to my computer.

I'm currently using a script with WinSCP which does work well but it doesn't delete any files that are already in the local directory.

If it helps, this is the current script I am using

> option batch abort  
> option confirm off  
> open sftp://[username/password/host] -hostkey="[keyhere]"  
> get -delete "/media/sdh1/matt3/Files/\*" "E:\Files"  
> exit

In short, I want to be able to download files from the server to my computer and have the file deleted from the server as well as delete any local files if there's already one in that folder, if not don't delete.

Hope that helps.

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 7, 2022, 4:25pm UTC](https://forum.rclone.org/t/move-and-delete/29133/13 "2022-02-07T16:25:22Z")

</div>

with rclone, create a sftp remote.  
use that to transfer files from linux to windows.

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 4:27pm UTC](https://forum.rclone.org/t/move-and-delete/29133/14 "2022-02-07T16:27:41Z")

</div>

I have already setup an SFTP remote (I think I did it correctly) but the command isn't working ☹

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 7, 2022, 4:31pm UTC](https://forum.rclone.org/t/move-and-delete/29133/15 "2022-02-07T16:31:56Z")

</div>

always test with a simple command.  
`rclone ls remote:`

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 4:33pm UTC](https://forum.rclone.org/t/move-and-delete/29133/16 "2022-02-07T16:33:57Z")

</div>

This is what I get when I run that command.

```auto
2022/02/07 16:33:28 Failed to create file system for "remote:": didn't find section in config file

```

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 7, 2022, 4:34pm UTC](https://forum.rclone.org/t/move-and-delete/29133/17 "2022-02-07T16:34:45Z")

</div>

change `remote:` to name of the sftp remote you created.

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 4:37pm UTC](https://forum.rclone.org/t/move-and-delete/29133/18 "2022-02-07T16:37:16Z")

</div>

Oh Ok. I just did that and it's listed everything so looks like it has been setup correctly.

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [February 7, 2022, 4:40pm UTC](https://forum.rclone.org/t/move-and-delete/29133/19 "2022-02-07T16:40:10Z")

</div>

good, so now write a command and test it.

---

<div class="post-metadata">

**Author:** ![matt3m](https://forum.rclone.org/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@matt3m](https://forum.rclone.org/u/matt3m)\
**Post date:** [February 7, 2022, 4:44pm UTC](https://forum.rclone.org/t/move-and-delete/29133/20 "2022-02-07T16:44:51Z")

</div>

Still getting this error message

```auto
2022/02/07 16:43:52 ERROR : Local file system at //?/C:/media/sdh1/matt3/test/hello.docx: error reading source root directory: directory not found
2022/02/07 16:43:52 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2022/02/07 16:43:52 ERROR : Local file system at //?/C:/media/sdh1/matt3/test/hello.docx: error reading source root directory: directory not found
2022/02/07 16:43:52 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2022/02/07 16:43:52 ERROR : Local file system at //?/C:/media/sdh1/matt3/test/hello.docx: error reading source root directory: directory not found
2022/02/07 16:43:52 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2022/02/07 16:43:52 Failed to move: directory not found

```

Using this command...

```auto
 rclone move "/media/sdh1/matt3/test/hello.docx" "E:\Test\"

```

[Next page](https://forum.rclone.org/t/move-and-delete/29133.md?page=2)
