• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 753
  • Last Modified:

Need a vbs copy script

I am looking for a VBS script that will copy a file(s) with the previous days date from one location to another.
0
ohmErnie
Asked:
ohmErnie
1 Solution
 
chandru_solCommented:
0
 
RobSampsonCommented:
Hi, does this file have a specific name, or are you searching through a folder?  Or does the file name include yesterday's date in the file name? Or are you wanting to check the date last modified?  Please provide more info on what you want to copy from where....

Regards,

Rob.
0
 
ghostdog74Commented:

N=Now
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder="c:\source_dir"
strNewDest = "c:\new_dest"
Set objFolder = objFSO.GetFolder(strFolder)
For Each strFiles In objFolder.Files
      If DateDiff("d",N, strFiles.DateLastModified) = -1 Then            
            objFSO.MoveFile strFiles , strNewDest & "\" & strFiles.Name
      End If
Next
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ohmErnieAuthor Commented:
ghostdog74,

This script only seems to copy 1 of the files with a date Now - 1.  How do I get it to copy more than 1 file that has a modified date of Now - 1?
0
 
RobSampsonCommented:
ghostdog74's code should copy more than one file.....in fact, it should copy every file in the folder from strFolder that has a difference in date of -1.  Are you sure you have more than 1 file that has a last modified date of yesterday?

Regards,

Rob.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now