Copy a pdf fil from 1 folder to another

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,104
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello All

I am trying to copy .pdf files from 1 folder to another. This i can do.

But, i want to only copy the ones that have -SW at the end of the pdf name.

from N:\OFFICE\PROJECT QUICK QUOTES\22687

to N:\PRODUCTS\PRODUCT FOLDERS\22687

example of pdf name : BBLight-SW

Any help would be appriciated

thanks

Dave
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
It depends how you're looping through the files in the source folder.

For a native VBA Dir loop you would specify the initial Dir file search like this:
VBA Code:
PDFfile = Dir(sourceFolder & "*-SW.pdf")

For a FileSystemObject loop you would look for matching files with the Like operator like this:
VBA Code:
If LCase(FSOfile.Name) Like "*-sw.pdf" Then
 
Upvote 0
Thanks John

Thats very helpful.

I am considering my options on this, as i may just drop the relevent .pdfs into a folder and copy the whole folder.
 
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,791
Members
449,188
Latest member
Hoffk036

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