#1 2023-05-09 18:23

Starroma
Member
Registered: 2015-07-04
Posts: 6

Move the file to the folder with its name

Hi!
I want to move a file to a folder with its name. To do this, I use the "Insert" rule. I insert the Meta Tags ":File_FilePath:\:File_FileName:" and the "Replase current name" function. The Preview shows no errors. But when trying to rename, Renamer throws an error: "Cannot create file or folder. (82)".
What am I doing wrong?

Offline

#2 2023-05-09 20:21

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: Move the file to the folder with its name

Let's say you have a file:

C:\Data\File.ext

Your renaming rule will generate a new name like this:

C:\Data\File.ext\File.ext

In order to move the file to this location, the folder "File.ext" must be created first, but this can't be done because there is a file at this path. Hence, you get an error "Cannot create file or folder".

Maybe you can drop the file extension from the folder name, i.e. naming the folder "File" instead of "File.ext", so to avoid the conflict?

In that case you need to use the following meta tags:

:File_FolderPath:\:File_BaseName:\:File_FileName:

This will generate a new name like this:

C:\Data\File\File.ext

Alternatively, you can rename in two steps. First, insert a dummy character in front of all filenames and rename. Then, use your original rule but also strip the dummy character, so to avoid the previously encountered conflict.

Offline

#3 2023-05-10 01:40

Starroma
Member
Registered: 2015-07-04
Posts: 6

Re: Move the file to the folder with its name

den4b wrote:

Let's say you have a file:

C:\Data\File.ext

Maybe you can drop the file extension from the folder name, i.e. naming the folder "File" instead of "File.ext", so to avoid the conflict?

In that case you need to use the following meta tags:

:File_FolderPath:\:File_BaseName:\:File_FileName:

This will generate a new name like this:

C:\Data\File\File.ext

Thanks, it works perfectly!

Offline

Board footer

Powered by FluxBB