Merging folders and sub folders

Bulk Rename Utility How-To's

Merging folders and sub folders

Postby bulkyAdmin » Mon Feb 19, 2024 2:11 pm

I hade a teams sync issue, and a user that thought they could click around an fix things themselves. What was a small issue is now a company wide problem.

I have about 9000 Folders with the name OriginalFolderName-LAPTOP12 and another 9000 folders with OriginalFolderName

Is there a way to search for every folder and subfolder containing -LAPTOP12, Remove the -LAPTOP12, and have it merge with -OriginalFolderName?

My F2 key is starting to wear out going through renaming everything one by one so ANY help would be greatly appreciated!!
bulkyAdmin
 
Posts: 1
Joined: Mon Feb 19, 2024 2:02 pm

Re: Merging folders and sub folders

Postby therube » Mon Feb 19, 2024 6:07 pm

(I don't believe it can be done through the basic GUI.)


I wonder if that could be done with JavaScript Renaming?


With the -LAPTOP12 files, are there apt to be name collisions with the files in OriginalFolderName?
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Merging folders and sub folders

Postby Admin » Tue Feb 20, 2024 12:26 am

Hi, you can rename those folders easily with Bulk Rename Utility... But the merging part won't work, e.g. it will probably give an error message because the same folder name already exists.
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm

Re: Merging folders and sub folders

Postby Admin » Tue Feb 20, 2024 12:29 am

What you could do is rename the files within those folders, so you change their path,
from OriginalFolderName-LAPTOP12 to OriginalFolderName

then delete the remaining folders OriginalFolderName-LAPTOP12 that are now empty.
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm

Re: Merging folders and sub folders

Postby therube » Tue Feb 20, 2024 5:42 pm

the merging part won't work, e.g. it will probably give an error message

Correct.
What you could do is rename the files within those folders, so you change their path

Yes.
But, 13:Copy/Move does not allow a (variable replaced) relative location, so you'd have to do that 9000 times?

OriginalFolderName-LAPTOP12 -> OriginalFolderName
but
Folder2-LAPTOP12
Folder3-LAPTOP12
...

You'd have to do each, individually.

If you could %name%-LAPTOP12 -> %name%, i.e., removing the "-LAPTOP12" part from each directory, & then move the files... such that:

OriginalFolderName-LAPTOP12 -> OriginalFolderName &
Folder2-LAPTOP12 -> Folder2
Folder3-LAPTOP12 -> Folder3
....

Then, & assuming they are all in fact named "-LAPTOP12", could be done in one shot.
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Merging folders and sub folders

Postby therube » Wed Feb 28, 2024 9:33 pm

Come to think of it, I came across something similar a while back, that I did, with the help of Everything, but using Windows (facilities).

Merge Directory Structures.


Similar, I'd think you could automate things with a batch file & replacement variables, to iterate through your directories, & for every file in in a *-LAPTOP12 directory, move its' contents into the respective DIRNAME sans the -LAPTOP12 part.
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: Merging folders and sub folders

Postby Admin » Wed Feb 28, 2024 11:21 pm

In Bulk Rename Utility, the new location in
13:Copy/Move
can be changed programmatically in Javascript, per file, so files can be moved based on their name in a different location.
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm


Return to How-To