rakkad
asked on
Create a vbscript that will copy files which include wildcards
I need a vbscript that will copy files which include wildcards..
1. Check certain files e.g Y01A*.*, GPL.MT940*.*, GPL.CRCSV*.* exist in a file location \\cslwinapp08\bacs, check that three files exist if not, write a log stating 'files don't exist', report a log to state which files are missing.
2. if these three files exist in \\cslwinapp08\bacs copy these files to \\cslwinapp10\bacs
3. Check that these files have been copied to \\cslwinapp10\bacs and write a log to confirm 'files copied'
Thanks
1. Check certain files e.g Y01A*.*, GPL.MT940*.*, GPL.CRCSV*.* exist in a file location \\cslwinapp08\bacs, check that three files exist if not, write a log stating 'files don't exist', report a log to state which files are missing.
2. if these three files exist in \\cslwinapp08\bacs copy these files to \\cslwinapp10\bacs
3. Check that these files have been copied to \\cslwinapp10\bacs and write a log to confirm 'files copied'
Thanks
ASKER
I think I may have not explained myself properly...
Essentially the three files will be created on a daily basis which has a date/stamp, so:-
Y01A.100012.20141104
GPL.MT940.100013.20141104
GPL.CRCSV.100013.20141104
So therefore, I want to include wildcards in the filenames, so the files can be copied
e.g
Y01A.*.*
GPL.MT940.*.*
GPL.CRCSV.*.*
Thanks
Essentially the three files will be created on a daily basis which has a date/stamp, so:-
Y01A.100012.20141104
GPL.MT940.100013.20141104
GPL.CRCSV.100013.20141104
So therefore, I want to include wildcards in the filenames, so the files can be copied
e.g
Y01A.*.*
GPL.MT940.*.*
GPL.CRCSV.*.*
Thanks
The patterns are on line 9. I tested with these filenames and the script works. Did you encounter a specific problem or does the script do something you don't want?
If you want some more logging, remove the ' in front of some of the lines like 70, 79.
ASKER
The files will be presented in the format as specified i.e the date created..
But use wildcards to copy the complete file, similar process if using a copy command in dos using wildcards for filenames
Hope this sounds clear ?
Thanks
But use wildcards to copy the complete file, similar process if using a copy command in dos using wildcards for filenames
Hope this sounds clear ?
Thanks
That is exactly what the script does, on line 46. But you asked for a check that all 3 files are present so that's what most of the rest of the code is for ;-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window