Using FileCopy then deleting the Source Folder (1 Viewer)

jmaty23

Registered User.
Local time
Today, 17:15
Joined
Jul 24, 2012
Messages
53
I am using FileCopy to copy a PDF file from my local hard drive to a network share.

The FileCopy part works fine but when I go to delete the folder that the source file is stored, it tells me that the file or folder is in use by another program.

One thing that allows me to delete the folder is if I close down Access. It is like Access "releases" the folder so that it can then be deleted. I'd like to be able to delete the source folder if I want to without having to close Access every time.

Any thoughts on this??
 

jmaty23

Registered User.
Local time
Today, 17:15
Joined
Jul 24, 2012
Messages
53
After doing some further digging, I came across the CHDIR function. This allowed me to change the current directory to something other than the source folder. Once I ran this function, I was able to delete the source folder.
 

Minty

AWF VIP
Local time
Today, 22:15
Joined
Jul 26, 2013
Messages
10,371
Out of interest - What code were you using to delete the file, then folder?
I've not come across this unless the folder still had files in it.
 

jmaty23

Registered User.
Local time
Today, 17:15
Joined
Jul 24, 2012
Messages
53
I was trying to delete it right from the explorer window.
 

Minty

AWF VIP
Local time
Today, 22:15
Joined
Jul 26, 2013
Messages
10,371
Ah - I assumed you where deleting it from within Access.
 

Users who are viewing this thread

Top Bottom