Moving files over to a new folder from seperate date folders

Hi again!

I've been trying, but I'm nog getting the hang of it.
I want to do the following

I have these folders with various dates:

2021.01.06 DC Week
2021.01.06 Image Week
2021.01.06 INDIE Week
2021.01.06 Marvel Week
2021.01.13 DC Week
2021.01.13 Image Week
2021.01.13 INDIE Week
2021.01.13 Marvel Week
all the way to 2025


I would like the files that are in these folders (all cbr/cbz) to move to one new folder named:

DC
IMAGE
INDIE
MARVEL

So all DC week dates in one DC folder. etc

Now I'm cut/paste these manually, but I was wondering if AR could do this for me to.
Reply to #1:

Hi again pindakaas,

No problem, but I need clarification. Did you mean you want to move all the containing FOLDERS, with the files inside, to the new folders that separate by brand?

Or do you want to leave the old folders where they are and move the files inside them *ONLY*, to the new container folders? If this is the version you want, are the files labeled by date as well? If you want to do it this way I need to see what format the files are in.

Please answer and I'm sure we can help you.

Best,
DF
Reply to #2:

Hi DF,

Sorry for not being clear.
I only want to move all the files out of the 'date-folders' and put them all together in one main folder. (DC IMAGE INDIE or MARVEL)
So yes, your second one. Leave the old folders and move them to the new folder.

The files are not labeled by date, see this example: Neon Future v2 004 (2020)

But then I can use your method from the other topic to cluster all those seperate files together in one folder named: Neon Future.
Reply to #3:

OK, buddy,

That's a really small example size (n=1) but based on what you've told me try this script. First make sure the Batch mode is set to "Rename" (the script takes care assigning a new path for the files to the correct folder). Add your files (drag the FOLDERS to the files list and tell ARen to open the FILES in the folders. Add that "New Path" column like I showed you before. Then open a blank script method in the method list. Copy the lines between the "// ------------------" lines and paste them into the main window of the script and press the "Apply script" button.

You should see your new paths in the path preview. If it's not correct don't execute the batch; get back to me here first. If it is correct give it a shot, and remember you can always UNDO the batch if the results aren't to your liking. Ok, here's the script:

// ------------------------------------
// grab the current folder name:
p = app.parseTags( '<FolderName>' ) ;
// split the folder name on spaces:
w = p.split( " " ) ;
// Take the first text word and uppercase it:
np = w[1].toUpperCase() ;
// Grab the current path, split it on backslashes:
op = item.path.split( "\\" ) ;
// Define empty var to hold the new path:
temp = "" ;
// Cycle through the path parts, adding the good ones back in
// (this will give you the path to the next level up):
for ( j = 0; j < op.length - 2; j++ ) {
temp = temp + op[j] + "\\";
}
// Add the new folder name (the var "np") to the end of the path:
item.newPath = temp + "\\" + np ;
// that SHOULD distribute the files to the new directory names!
// ------------------------------------

There you have it. Hopefully this will do what you need. :) Hit me back with any problems!

Best,
DF
Reply to #4:

Hi DF,
I think I'm doing something wrong because the path and new path are the same..?
I did copied the script and applied it
See the following screenshots:
https://jumpshare.com/s/Kc7OMrmFz271CcNKM5Ik
https://jumpshare.com/s/GlmSNZoDFV2QIaPtLfT1



Reply to #6:
Hi.
Forgive my intrusion.
The image shows you're using a move method in addition to the script. Try disabling it.
Reply to #7:

Hey Miguel! Where ya been bro? Never an intrusion (at least for me :), I've missed you.

pindakaas: Yes, try that first. I'll tell you that I copied the path structure and file name I could see in your screenshot and got good results. I even copied the script from my post to make sure I didn't make an error in transcribing the script and adding comments. All good.

EDIT: Made more directories and added the example files from previous examples and they all worked correctly as well. END EDIT

As an aside, either that was a weird screenshot or there's something wrong with the way my system sees other pic-sharing sites. As I've mentioned many times, imgur doesn't work for me at all. I use Shift+WindowsKey+S to take the screenshot and put the screenshot into Google drive, and I get results like this:

https://drive.google.com/file/d/1UQeBDIQkIo-AhoTxbmJfDd7m1jd SKB_x/view?usp=sharing

If you don't see a big difference between this screenshot and yours then something's wrong with my system...

Anyway, let me know how it goes for you. As a workaround I'm trying to figure out another way to do what you want, I'll keep ya posted... Miguel, Styb, you guys have any ideas for other ways to do this?

Best,
DF
Reply to #8:

Well, I am confused now as to what exactly we are trying to do here, but here's something else you can try if you can't get the script to work for you.

1) in a new instance of ARen with no methods, set Batch mode to MOVE and enter

<word:4>

in the Output folder: field. If you then load your original FOLDERS, and your folders are all in the format [nnnn.nn.nn alphaword<etc>], that should put the FOLDERS into a new folder like

Absolute
Aliens
Batgirl
Image

etc, depending on that first word after the date.

2) You can then load the new folders into a NEW instance of ARen, add a New case method, and upper-case that word. I'm not sure if that's what you want, but it's a way to get the files into a new (uppercase) one-word folder.

You'd still have the files in the old folders within the new folders, so you'd have to

3) add the FILES to a NEW instance of ARen and select batch MOVE, moving the files to "..\" to move them out of the old folder and directly into the new folder.

You've then got your files into what I THINK is the folder you want, but you've still got the old folders within the new ones. If you wanted to add another step, you can then

4) drag the new FOLDERS into that last instance of ARen (the one that moved the FILES) and tell it to load the subfolders (instead of adding root folders) and then change the Batch Move "Output folder:" field to something like "..\#recycle". That would put all the old folders into a #recycle folder, one level up from your files, where you could

5) batch delete them with File Explorer (or whatever).

That's not nearly as slick as using the script, so I hope you get that working, but still it's another way to do what you want (I think... like I said, I'm totally confused at this point! :[ ). With all that to-ing and fro-ing there's a lot more chance for a screw-up, so only do this if we can't get the script to work.

Anyway, just a thought. Let us know how it's going with you.

Best,
DF
Reply to #6:
Hi,
The DF´s script work perfectly for me.
https://drive.google.com/file/d/1_Qq0QfdXCSX87v7_YXm5bJZhsoH hONEn/view?usp=drive_link

Miguel
Reply to #9:

Hi DF,

This is it! Many thanks for helping! This saves me a lot of time.

Greetings, pk