Script to rename and move files to new location with new folder structure

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
megahertz
Posts: 10
Joined: 13 Jun 2018, 02:13

Script to rename and move files to new location with new folder structure

Post by megahertz »

I'm kinda new to filebot and have just setup a seedbox to download.

I have movies going into a folder /downloads/watch and wanting to have the movies renamed and moved to a location, /downloads/Movies
I am wanting to either rename the folder they are contained within to match the filename, in the format of movie [year].extension, or create the folder and place the video file in it during the move.

What command would I need to perform this?
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script to rename and move files to new location with new folder structure

Post by rednoah »

What have you tried so far? Where did you get stuck? Have you tried the amc script yet?
:idea: Please read the FAQ and How to Request Help.
megahertz
Posts: 10
Joined: 13 Jun 2018, 02:13

Re: Script to rename and move files to new location with new folder structure

Post by megahertz »

I've been trying the following that I grabbed from another post on here

Code: Select all

filebot -rename /downloads/watch/ --db TheMovieDB -no-xattr --action hardlink --format "/downloads/Movies/{n} ({y})/{n} ({y}){f.substring(3)}" -non-strict "$@"
At the moment I am getting an error message stating there are no media files.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script to rename and move files to new location with new folder structure

Post by rednoah »

1.
megahertz wrote: 13 Jun 2018, 07:38 At the moment I am getting an error message stating there are no media files.
What does "$@" do exactly? What does -rename /downloads/watch/ do? What does -r do?

:idea: These questions will hint you towards the right direction. ;)


2.
I highly recommend just using the amc script for new comers. It'll work out of the box and comes with lots of documentation. Copying commands from the forums is not a good idea, unless you fully understand how it works and what it does.
:idea: Please read the FAQ and How to Request Help.
megahertz
Posts: 10
Joined: 13 Jun 2018, 02:13

Re: Script to rename and move files to new location with new folder structure

Post by megahertz »

I tried the amc script and got a 'script not found' error.
I believe it may be due to my seedbox provider using an older version of filebox (4.7 r3923 I believe).
I already contacted my provider and they are unwilling to update the version of filebot to a later one.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script to rename and move files to new location with new folder structure

Post by rednoah »

What does filebot -version say?
:idea: Please read the FAQ and How to Request Help.
megahertz
Posts: 10
Joined: 13 Jun 2018, 02:13

Re: Script to rename and move files to new location with new folder structure

Post by megahertz »

Code: Select all

FileBot 4.7 (r3923) / Java(TM) SE Runtime Environment 1.8.0_151 (headless)
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script to rename and move files to new location with new folder structure

Post by rednoah »

I see. That release is from 2 May 2016 so it's quite outdated and I'd be surprised if it works at all.

:idea: If you rely on deprecated tooling now, because you'll be wasting time on things that just don't work, or just won't work in the future.

:idea: I don't know what the error message says, but it sounds like it's failing right away because you're not passing in any input files. Presumably, even if you manage to pass in files, it'll just run into more and more errors because this version is too outdated and probably just doesn't work anymore.
:idea: Please read the FAQ and How to Request Help.
megahertz
Posts: 10
Joined: 13 Jun 2018, 02:13

Re: Script to rename and move files to new location with new folder structure

Post by megahertz »

Unfortunately, short of changing provider, I am stuck with it for the moment.

The folder I have media files in contains other folders with media files in them as well.
I am not sure why it is not able to find them
megahertz
Posts: 10
Joined: 13 Jun 2018, 02:13

Re: Script to rename and move files to new location with new folder structure

Post by megahertz »

Ok my provider has update filebot to version 4.7.9 which now allows me to run the amc script, however it just looks to be sitting there doing nothing after using the following

Code: Select all

filebot -script fn:amc --output "/downloads/Movies/" --action copy -non-strict "/downloads/watch/
megahertz
Posts: 10
Joined: 13 Jun 2018, 02:13

Re: Script to rename and move files to new location with new folder structure

Post by megahertz »

All good, I think I have finally figured it out.

I now need to figure out how to remove the empty folders left behind in my source location.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script to rename and move files to new location with new folder structure

Post by rednoah »

1.
You can use the cleaner script for that:
viewtopic.php?f=4&t=5#p1341


2.
Don't forget to use --def excludeList if you're automatically and repeatedly running filebot on the same folder. Please read the Run from cmdline section in the manual:
viewtopic.php?f=4&t=215
:idea: Please read the FAQ and How to Request Help.
Post Reply