# Moving all files (including non mp3) and rename if required

**URL:** https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511
**Category:** Support
**Created:** [November 5, 2017, 3:22pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511 "2017-11-05T15:22:53Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [November 5, 2017, 3:22pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/1 "2017-11-05T15:22:53Z")

</div>

So here is what I am trying to tweak so it works properly...  
I have an action that once I have processed the tags the way I want to it moves the files to a new folder from the existing one as completed...

FormatValue Directory:  
$validate($replace(G:\Music$upper('['$left(%albumartist%,1)']')\%albumartist%\%album% $num(%year%,4), , ), %mediatype%,'\_')

This works fine if there is no other non MP3 files (such as an artowrk folder) in the originating folder....am trying to pull that with it...

Than I would like to use the below for multi disc formating:

FormatValue Filename:  
Disc $num(%discnumber%,2)\%\_filename\_ext%

However when I do this in sequence, it puts the files back into the originating folder...any way to anchor this FormatValue Filename action to the newly created Directory done from the above?

These work individually but would like to not have to re import the new folder for processing the multi disc folder request....and would also like to be able to pull any other non mp3 folder (ie: Artwork) during the initial move...

Thanks in advance as always ....

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 5, 2017, 3:34pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/2 "2017-11-05T15:34:27Z")

</div>

If you use fully qualified filenames with drive letter and the full path then you get the files into that folder that you want.  
Relative filenames lead to relative paths - and that path may be longer or shorter.  
I am a little puzzled about the statement  
$num(%year%,4)  
If this is intended to create a year with 4 digits, then it is not correct - even though it works:  
The $num() function transforms a string into a number (and adds padding if stated) - it does not take the first stated digits - this would be achieved with $left(%year%,4)  
If you have a date like  
'2017-01-11' in the field YEAR then you do get 2017 with $num() as $num() stops its transformation at the first non-numeric character. That is why $num() is the function of choice to transform a track number of the format 2/10 into a plain 2.  
Sorry, if the last bit was man-splaining.

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [November 5, 2017, 5:20pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/3 "2017-11-05T17:20:27Z")

</div>

Fair enough thank you for the explanation......As you pointed out it works for its purpose but isn't actually the correct usage...I will adjust going forward however the original question still remains....If I have just renamed the folder in the action above the file rename, how can I than use a fully qualified path if I have just used the tags to rename the folder?

As well, how do I get it to pull anything extra (cover art folder) with the move as my existing actions leave them behind and they than have to be manually moved...?

Should I perhaps use a "\_working dir" tag and poplulate it with the new folder path than use something like the Disc $num(%discnumber%,2)\%\_filename\_ext% option? Or is that just complicating it more...I do tend to overthink things....

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 5, 2017, 5:58pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/4 "2017-11-05T17:58:27Z")

</div>

If you rename a folder like

e:\music\abba\gold  
(which follows the pattern of e:\music\%artist%\%album%  
with an action of the type "Format value" for \_directory to  
e:\music\abba\goldener  
and the original folder  
e:\music\abba\gold  
contains a folder  
e:\music\abba\gold\pictures  
then this picture folder will be moved also to  
e:\music\abba\goldener  
becoming  
e:\music\abba\goldener\pictures.

The rule of the thumb:  
Formatting the \_FILENAME really only treats the individual file.  
Formatting the \_DIRECTORY moves the whole folder to a new location and takes all objects in it along.  
So if you want to rename files and folders in the same action group then format the \_FILENAME with just the name components but no path ingredient.  
Then format the \_DIRECTORY with an absolute path (but no \_FILENAME components).

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [November 26, 2017, 6:38pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/5 "2017-11-26T18:38:43Z")

</div>

Which makes sense but why is it when I have moved using format \_DIRECTORY to a new location than attempt to use format \_FILENAME to put into individual disc folders in the NEW DIRECTORY that was just created does the system move them back to the ORIGINAL starting folder at the beginning of the process once the format \_FILENAME action is applied? They would appear to be anchored in some way and if I refresh the tags prior to the \_FILENAME format using the Refresh file view option they disappear as they are no longer in the original location?  
True I can go to the new location and pull the files for processing that way however if there is an easier solution?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [November 26, 2017, 6:44pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/6 "2017-11-26T18:44:34Z")

</div>

I think I read somewhere in the threads that in action groups those actions that rename a folder or generate a report are always executed last for all the files.  
So this could be the source for the puzzling behaviour.

I would use absolute paths in this action group. This would move all the files to the new destination and finally rename the folder. Or something like that.

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [December 17, 2017, 6:21pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/7 "2017-12-17T18:21:41Z")

</div>

@Florian:  
Any idea why after a rename \_directory function is applied why is that if you try to apply a \_filename format all files are moved back to the origin directory and the \_filename rename is not applied to the updated directory?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [December 17, 2017, 6:28pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/8 "2017-12-17T18:28:32Z")

</div>

What happens if you use an absolute filename to rename the files?

---

<div class="post-metadata">

### Author: ![Ron\_Mark](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Ron\_Mark](https://community.mp3tag.de/u/Ron_Mark)
#### Post date: [February 14, 2018, 2:12am UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/9 "2018-02-14T02:12:40Z")

</div>

So I have fixed this issue by adding folder path to the equation and this seems to have resolved the pull back.  
So basically the new function is:

Format Value:  
\_Filename

%folderpath%Disc $num(%discnumber%,2)%\_filename\_ext%

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:27pm UTC](https://community.mp3tag.de/t/moving-all-files-including-non-mp3-and-rename-if-required/19511/10 "2026-02-09T12:27:05Z")

</div>


