FSO.copyfile issue.

Devonair

New Member
Joined
Apr 17, 2019
Messages
26
Hi guys,

I have a problem, I made a Sub function that copies files to multiple folder.
its working fine except for one particular folder. I don't understand why it is keep copying 1 level below of target sub folder and the filename is changed to April - 1901-04-2019 <filename>.<ext>. All other files in different folders are copied normally without issue.

I used debug.print to see the source location and the print out

-Source-
the sub directory OK
the filename

-Destination-
the sub directory OK
the filename CHANGED

and after copy seeing the result its below 1 level sub directory.

Ex
M:\sub1\sub2\sub3\<filename>.<ext>
copied to....
M:\sub1\sub2\<date with 1909 year><filename>.<ext>



Anybody has an Idea why it is doing like this?
I copy to network server by the way.



Thanks again guys
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Most probably you are missing a \ at the end of the path so the last folder becomes part of the filename.
To be on the safe side always add a \ at the end of the path - FSO treats consecutive \ as one so you don't have to worry about that too.

And it is always best to post at least the relevant part of your code - esp. if you are getting weird errors.
 
Last edited:
Upvote 0
Please post the entire code that you are using, mark which line is causing the error & include the full error message
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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