Pdf movement to folder

Faiyaz

New Member
Joined
Jan 6, 2024
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hii can anyone help me how can i move multiple pdf from one folder to another folder using the starting name of pdf
Eg: There are 100 pdf file with the name (invoice_001 lane_inv, invoice_005 street_inv, payment_009 creek_inv) and so on i need to move all the pdf with invoice name to' Invoice' folder and all payment pdf to 'Payment' Folder. How can i do that can anyone explain me in detail as i don't have much idea about it
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You marked the answer as solved.
 
Upvote 0
No i did it by mistakenly it still haven't been solved
 
Upvote 0
No i did it by mistakenly it still haven't been solved
The thing is your code is working but when i change my file name to invoice_ and payment_ then only it working but my file name are different like( invoice_239 southwest creek_inv, invoice_789 northern hill lane_inv, invoice_890 burfod lane_inv) etc i need all the pdf starting with invoice in one folder and all the pdf starting with payment in another one that's not working. Can you help me with that
 
Upvote 0
The thing is your code is working but when i change my file name to invoice_ and payment_ then only it working but my file name are different like( invoice_239 southwest creek_inv, invoice_789 northern hill lane_inv, invoice_890 burfod lane_inv) etc i need all the pdf starting with invoice in one folder and all the pdf starting with payment in another one that's not working. Can you help me with that
Screenshot_2024-01-07-16-16-49-50_99c04817c0de5652397fc8b56c3b3817.jpg

See this i have like this file i need all the pdf starting with Reliance in one folder all the pdf's starting with tata power in one folder and so on
 
Last edited:
Upvote 0
yes for different filenames you have to rewrite a bit. Now only payment and incoice will be taken into account. I can’t look into your pc
 
Upvote 0
yes for different filenames you have to rewrite a bit. Now only payment and incoice will be taken into account. I can’t look into your pc
How can i rewrite it can you explain it to me. I have around 7000 pdf file with different names i need to move all thoose pdf. Do help me with that
 
Upvote 0
Thie is an example for it
 

Attachments

  • Screenshot_2024-01-07-16-16-49-50_99c04817c0de5652397fc8b56c3b3817.jpg
    Screenshot_2024-01-07-16-16-49-50_99c04817c0de5652397fc8b56c3b3817.jpg
    131.4 KB · Views: 3
Upvote 0
VBA Code:
Sub jec()
 Dim srcPath, destFold, destPath, it
 With Application.FileDialog(msoFileDialogFolderPicker)
    If .Show = 0 Then Exit Sub
    srcPath = .SelectedItems(1) & "\"
    destFold = Left(srcPath, InStrRev(srcPath, "\", Len(srcPath) - 1))
    With CreateObject("scripting.filesystemobject")
       For Each it In .getfolder(srcPath).Files
         If LCase(it.Name) Like "*_*.pdf" Then
            destPath = destFold & StrConv(Split(it.Name, "_")(0), vbProperCase) & "\"
            If Not .folderexists(destPath) Then .createfolder destPath
            .movefile srcPath & it.Name, destPath & it.Name
         End If
       Next
    End With
 End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,189
Members
449,090
Latest member
bes000

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