We help IT Professionals succeed at work.
Get Started

VB Script: Delete, copy, rename files

Luis Diaz
Luis Diaz asked
on
115 Views
Last Modified: 2015-03-03
Hello experts,

I am looking for a vbscript that do the following:

1-Delete xls file with the following name "test.xls” located in Current Directory in which the vbscript is launched
2-Copy a the most recent file from a folder to Current directory begin with the following prefix "AD_report" (Every day there are two reports generated with the same prefix the most recent file need to be copy)
3-Rename in the Current Directory the report "AD_report" as "test.xls"

Warning the Current Directory should be dynamically set up with
CurrentDirectory = objFSO.GetAbsolutePathName(".")
strDestFolder = CurrentDirectory & "\"

Logs requirements:

1-Log file should be named as following log-delete-copy.txt
2-if the file test.xls doesn't exist log output should “"test.xls" doesn't exist””
3-If the folder set up for copy the most recent files doesn't exist log output “ the folder  variable doesn't exist”
4-If any files with the following prefix ""AD_report" doesn't exist the log output should "Any report with the follwing prefix has been found unable to copy it”.


Thank you in advance
Comment
Watch Question
Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE