Page 1 of 2

Get name of parent folder of parent folder of file

Posted: 16 Nov 2016, 01:01
by RBCC
Image
I am trying to figure out the steps involved in doing what is show in the picture , could someone write a tutorial? John

Re: [Noob] How do I do this?

Posted: 16 Nov 2016, 02:47
by rednoah
Based on what I told you last time, you should know this already:

Code: Select all

f.dir.dir.name

Re: Get name of parent folder of parent folder of file

Posted: 16 Nov 2016, 03:08
by RBCC
How about f[2]?

Re: Get name of parent folder of parent folder of file

Posted: 16 Nov 2016, 04:49
by rednoah
Sure, but counting path elements from the left is probably not a good idea if you ever add an additional folder level.

Re: Get name of parent folder of parent folder of file

Posted: 25 Nov 2016, 02:27
by RBCC
I used file.dir.dir.name and got new directories created. How do i put the file in the same folder it came from? John

Re: Get name of parent folder of parent folder of file

Posted: 25 Nov 2016, 08:36
by rednoah
Your format should create a path like this "Avatar.avi" and not a path like this "/path/with/slashes/Avatar.avi" which will be resolved relative to wherever the file happens to be.

Re: Get name of parent folder of parent folder of file

Posted: 25 Nov 2016, 19:24
by RBCC
But they are all in seperate folder.
Say you have john,fred and sue in the folder c:\macgyver\seattle. And you want to use macgyver , episode 6. To put the renamed file into. But it makes a dir under the root for each file for each file. Is there anyway to put all them back into the dir they came from??? John

Re: Get name of parent folder of parent folder of file

Posted: 25 Nov 2016, 19:31
by rednoah
If you want FileBot to move your files to C:/A/B.c then you just need to write a format that evaluates to C:/A/B.c that's all.

Re: Get name of parent folder of parent folder of file

Posted: 25 Nov 2016, 22:11
by RBCC
I dont want them to be moved!
Just use the folder name that they are in as part of the name.

Re: Get name of parent folder of parent folder of file

Posted: 25 Nov 2016, 22:19
by rednoah
1. A filename:

Code: Select all

filename.ext
2. A relative path:

Code: Select all

file/name.ext
Presumably, your format is generating paths and not filenames. The difference betweens paths and filenames is that paths contain slashes while filename don't contain slashes.

Re: Get name of parent folder of parent folder of file

Posted: 27 Nov 2016, 18:23
by RBCC
Image
will f.dir.dir.name create a new folder? if so, how do I do this so it wont..
the folder that it is in is: M:\Diagnosis Murder\Season 7. John

Re: Get name of parent folder of parent folder of file

Posted: 27 Nov 2016, 18:34
by rednoah
What is the value of f.dir.dir.name?

Re: Get name of parent folder of parent folder of file

Posted: 28 Nov 2016, 00:09
by RBCC
Season 6

Re: Get name of parent folder of parent folder of file

Posted: 28 Nov 2016, 08:52
by rednoah
The String "Season 6" will definitely not cause the creation of any folders.

Re: Get name of parent folder of parent folder of file

Posted: 28 Nov 2016, 12:09
by RBCC
So will f.dir.dir.dir.name?

Re: Get name of parent folder of parent folder of file

Posted: 28 Nov 2016, 12:49
by rednoah
That depends on the value. If the value doesn't contain / or \ then no.

Look at the result:

If it's an absolute path it'll move files exactly as is:

Code: Select all

C:/a/b/c.mp4
If it's a relative path it'll move files relatively to where they are:

Code: Select all

b/c.mp4
If it's a file name, it'll rename files relatively to where they are:

Code: Select all

c.mp4

Re: Get name of parent folder of parent folder of file

Posted: 01 Dec 2016, 02:50
by RBCC
Image
How do I put the renamed file back into its original directory? DOes f.name. dir do this?

Re: Get name of parent folder of parent folder of file

Posted: 01 Dec 2016, 17:45
by rednoah
The format does not do anything. The format produces a file path, and then files will be move/renamed according to that file path.

What is the file path that your format produces? How is that file path not what you want it to be?

Re: Get name of parent folder of parent folder of file

Posted: 01 Dec 2016, 20:33
by RBCC
Y:/perry mason/1x19.mp4, John

Re: Get name of parent folder of parent folder of file

Posted: 04 Dec 2016, 06:20
by RBCC
The format produces absolute paths . such as

Code: Select all

c:/diagnosis murder/season 1/ diagnosis:murder 1x3.mp4
how to create a format call to use relative paths?

Code: Select all

/diagnosis:murder/season 1/diagnosis:murder 1x3.mp4
Or the filename.ext ie:

Code: Select all

diagnosis:murder 1x3.mp4
? If it uses absolute paths!
John

Re: Get name of parent folder of parent folder of file

Posted: 04 Dec 2016, 15:23
by rednoah
1.
If you want this path:

Code: Select all

diagnosis:murder 1x3.mp4
Then make your format expression only produce this path.


2.
Paths like this will work as expected:

Code: Select all

./diagnosis:murder 1x3.mp4

Code: Select all

../diagnosis:murder 1x3.mp4
If you don't know what . or .. means you will need to learn some basics first. ;)

Re: Get name of parent folder of parent folder of file

Posted: 04 Dec 2016, 17:05
by RBCC
I know that

Code: Select all

..
goes up one directory and

Code: Select all

 ..\.. 
goes up 2 , when I am in the editor of filebot do I put those in where the filename is such as

Code: Select all

../../diagnosis:murder 1x4.mp4
? Am I understanding you right? But if just want the season number

Code: Select all

..\..\[color=#0080FF]diagnosis:murder [/color]1x14.mp4

Re: Get name of parent folder of parent folder of file

Posted: 06 Dec 2016, 04:12
by RBCC
Would it be easier to use Y:/Diagnosis Murder/season 1/Diagnosis Murder 1x3.mp4 [Airdate] f.dir.dir.name episode title? so it will copy it to that location?

Before I was trying to use the ../.. in the format string! John

Re: Get name of parent folder of parent folder of file

Posted: 06 Dec 2016, 06:42
by RBCC
Please show code that shows how to copy the file to the right directory and use the new directory name for season #. So that it will be put into the right directory. Ok? John

Re: Get name of parent folder of parent folder of file

Posted: 07 Dec 2016, 08:32
by RBCC
Image
How do I copy a file into another directory and then using the new directory name use a part of that directory name and put it into the new folder for the file? Like in the picture! John