Moving Folders via VBA

jtgarrison85

New member
Local time
Today, 01:45
Joined
Mar 10, 2023
Messages
6
Good morning -

Within my database, I have a flag that will determine if the Project is Current or Archive.

Depending on the flag, I want to copy all files in the subdirectory from one file share to another. I want to do all of this via VBA.

Thanks in advance.

Jeff
 
Hi Jeff. Welcome to AWF!

You have plenty of choices. Check ou the Name As statement or the FileCopy and Kill commands or check out the File System Object.
 
Add to that the possibility of creating a command-line "SHELL" operation to bulk-rename files with wildcards as part of the name selection, if the names are predictable and follow a pattern.
 
They somewhat follow the same pattern -

The root would be the project number and then there could be numerous sub-folders underneath.

I need to be able to grab the project number and tell Access to move everything in that folder from the old location to the new location.

The easier the better. I want to be able to be in the project and tell it to move on the fly as well as be able to run a process that looks at the project close date and move everything 90+ days on the admin side (button in my admin options).
 
You want to move everything from folder A to folder B?

This is easy enough. How does folder B come to exist?
 
As already suggested by the_Doc_Man using the Name statement would probably be the easiest as it does all actions in one step(create new\copy\remove old):


Cheers,
 
It won't work using UNCs will it?

I am trying to archive old projects. In doing so, I want to move their network attachments to another file share.
 
If the UNC is correct, copying a folder from point A to point B will do fine. So will drive-letter:/path/ format. In fact, technically you ALWAYS use UNC because since WinNT, drive-letter is treated as an alias anyway. So a drive-letter specification gets translated internally before use.
 

Users who are viewing this thread

Back
Top Bottom