Rabu, 17 Juni 2020

Re: [MSAccessProfessionals] Shell command to move files

Arnelito,

What is the pros and cons of using the FSO and Shell?

Jim Wagner

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Arnelito Puzon <agpuzon@gmail.com>
Sent: Tuesday, June 16, 2020 5:07 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Shell command to move files
 
Const SOURCE_PATH As String = "C:\PutSourceFolderNameHere"
Const TARGET_PATH As String = "C:\PutTargetFolderNameHere"
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(SOURCE_PATH)
For Each objFile In objFolder.Files
    objFSO.MoveFile objFolder.ShortPath & "\" & objFile.Name, TARGET_PATH & "\" & objFile.Name
Next
Set objFile = othing
Set objFolder = Nothing
Set objFSO = Nothing


On Wed, Jun 17, 2020 at 7:35 AM Jim Wagner <josephwagner2@outlook.com> wrote:
I had tried that but I could not get it to work.

Jim Wagner

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Arnelito Puzon <agpuzon@gmail.com>
Sent: Tuesday, June 16, 2020 3:46 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Shell command to move files
 
You should consider using filesystem object rather than using shell cmd.



--
Arnelito G. Puzon


Tidak ada komentar:

Posting Komentar