How to rename and move files in separate folder

Support for Windows users
Post Reply
randy030991
Posts: 4
Joined: 25 Jan 2016, 11:07

How to rename and move files in separate folder

Post by randy030991 »

I have some video in separate folder in C:
WEST FOLDER, ANIMATION FOLDER and ANIME FOLDER

I make code to move that video from C: to G:


G:/BACKUP/DOWNLOAD/FILM/{n.replaceAll(/[:|]/, " - ")} ({y}) ({genres.take(2).join(' ')}) ({omdb.rating})/{n.replaceAll(/[:|]/, " - ")} ({y}) ({genres.take(2).join(' ')}) ({omdb.rating}){subt}

when I use that code, I hope it will make this:
G:/BACKUP/DOWNLOAD/FILM/WEST FOLDER
G:/BACKUP/DOWNLOAD/FILM/ANIMATION FOLDER
G:/BACKUP/DOWNLOAD/FILM/ANIME FOLDER

But all video just go to G:/BACKUP/DOWNLOAD/FILM/

-----------
So I try manually without filebot, move video to
G:/BACKUP/DOWNLOAD/FILM/WEST FOLDER
G:/BACKUP/DOWNLOAD/FILM/ANIMATION FOLDER
G:/BACKUP/DOWNLOAD/FILM/ANIME FOLDER

then I use this filebot code in every folder one by one
{n.replaceAll(/[:|]/, " - ")} ({y}) ({genres.take(2).join(' ')}) ({omdb.rating})/{n.replaceAll(/[:|]/, " - ")} ({y}) ({genres.take(2).join(' ')}) ({omdb.rating}){subt}

but all video just go to
G:/BACKUP/DOWNLOAD/

example
G:/BACKUP/DOWNLOAD/X-Men (2013) (Action) (8.8)
G:/BACKUP/DOWNLOAD/Finding Nemo (2011) (Action) (5.1)
G:/BACKUP/DOWNLOAD/Naruto (2010) (Action) (6.2)
----------

What is mistake in my code?
Thanks for your help.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to rename and move files in separate folder

Post by rednoah »

If you want your files to be moved into different folders based on some condition, then you need to express that condition in your format expression.


You seem to want to retain some information from the original path. I'd use file.path.match(...) for that:

Code: Select all

{file.path.match(/WEST|ANIMATION|ANIME/)}

FileBot will try to auto-detect the structure root if you use a relative path format. You can force FileBot to resolve relative formats against the current location though, just start your format with ./ or just use {folder} to reference the current folder.
:idea: Please read the FAQ and How to Request Help.
randy030991
Posts: 4
Joined: 25 Jan 2016, 11:07

Re: How to rename and move files in separate folder

Post by randy030991 »

thanks its work

{file.path.match(/WEST|ANIMATION|ANIME/)}
Post Reply