Move files based on part of their name VBA

pernekde

New Member
Joined
Mar 16, 2019
Messages
1
I have around 100 files in C:\Users\pernek\Desktop\_BEI_TEST as:

#Import#0181004401#0000015227_BEI_1300090026_20211206210105.xlsx
#Import#0181004484#0000015402_BEI_1300090402_20211208210242.xlsx
#Import#0181004404#0000015227_BEI_1300090026_20211206210105.xlsx
...

I have folders with parts of file names in the folder C:\Users\pernek\Desktop\_BEI_TEST\Nova mapa as:

321564_Lidl_0181004401
321564_Lidl_0181004484
353556_Lidl_0181004404
...

What I want to do is move files based on part of the file name to respective folders based on the name of the folder.

#Import#0181004401#0000015227_BEI_1300090026_20211206210105.xlsx move to 321564_Lidl_0181004401
#Import#0181004484#0000015402_BEI_1300090402_20211208210242.xlsx move to 321564_Lidl_0181004484
#Import#0181004401#0000015227_BEI_1300090026_20211206210105.xlsx move to 353556_Lidl_0181004404

The folders/file are the same only on the basis of one number ( 0181004401 , 0181004484 , 0181004404 )

any help?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Move files based on part of their name VBA
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,944
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top