Re: Moving Files by Michael
Michael
Tue Apr 10 18:35:01 CDT 2007
Paul wrote:
> I get this error message when trying to use ur code AL
>
> Microsoft VBScript compilation error: Cannot use parentheses when
> calling a Sub
>
Call fso.movefile(strFilePath & "\archive*.*", strDestination)
or (preferrably)...
fso.movefile strFilePath & "\archive*.*", strDestination
> "Al Dunbar" wrote:
>
>>
>> "Paul" <Paul@discussions.microsoft.com> wrote in message
>> news:61D3044F-9F7B-46B5-8C8C-1AB728729C15@microsoft.com...
>>> Hi,
>>>
>>> I need to create a script that moves certain files from a folder and
>>> places
>>> them in a new directory. I need to use the Like operator because I
>>> only know
>>> the start of the file name. I want to move all of the files that
>>> start with
>>> Archive in the config folder.
>>>
>>> Here is the code, what should i change to get this working
>>>
>>> Dim fso
>>> Set fso = CreateObject("Scripting.FileSystemObject")
>>>
>>> 'Copy xcacls.vbs to the users C:\windows\system32 directory
>>> strFilePath = "C:\windows\system32\config"
>>> strDestination = "\\resource\Installs\Backup\Event Logs"
>>>
>>> fso.movefile(strFilePath & "Like '%Archive%'", strDestination)
>>
>> The .movefile method expects the source argument to be a valid file
>> specification, optionally with standard filesystem wildcards in the
>> last item in the path - it does not have any sort of querying
>> capability. Try this instead:
>>
>> fso.movefile(strFilePath & "\archive*.*", strDestination)
>>
>> /Al
--
Michael Harris
Microsoft.MVP.Scripting