VBS Question 
Author Message
 VBS Question

Is there a network move command for VBS?  I am having problems moving files
over my network.

~Greg



Sun, 17 Jul 2005 02:49:49 GMT  
 VBS Question
what are you currently using to move files?

I'd probably fire a DOS command with WScript.exec

________________________________________
I got bored with my old signature,
so I changed it

Atrax. MVP, IIS
http://rtfm.atrax.co.uk/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sun, 17 Jul 2005 08:23:20 GMT  
 VBS Question

Quote:

> Is there a network move command for VBS?  I am having problems moving
> files over my network.

FSO (Scripting.FileSystemObject) methods can move/copy/delete files/folders
on mapped network drives or use UNC paths directly....

WSH 5.6 documentation download
http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/00...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US



Sun, 17 Jul 2005 08:42:41 GMT  
 VBS Question
I just can't seem to be able to move a directory with this script.

<:::::::::::::::::::::::::::::Script Begins:::::::::::::::::::::::::>

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "W:", "\\server\c$", "true"

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\test\start\*.*" , "W:"
WshNetwork.RemoveNetworkDrive("W:")

<:::::::::::::::::::::::::::::Script Ends:::::::::::::::::::::::::::::>


Quote:
> Is there a network move command for VBS?  I am having problems moving
files
> over my network.

> ~Greg



Mon, 18 Jul 2005 03:01:49 GMT  
 VBS Question

Quote:
> objFSO.MoveFolder "C:\test\start\*.*" , "W:"

What is your goal:

a)    to move all folders under "C:\test\start\ to "W:\test\start"?

b)    or to move "C:\test\start\ to "W:\start"?

c)    or what?



Mon, 18 Jul 2005 03:34:08 GMT  
 VBS Question
I guess what I am looking for is to move all folders under "C:\test\start\"
to "W:\test\finish\" across an NT network and also only move the folders
that have been modified 30 days from now.


Quote:
> > objFSO.MoveFolder "C:\test\start\*.*" , "W:"

> What is your goal:

> a)    to move all folders under "C:\test\start\ to "W:\test\start"?

> b)    or to move "C:\test\start\ to "W:\start"?

> c)    or what?



Mon, 18 Jul 2005 05:09:50 GMT  
 VBS Question

Quote:
>  I guess what I am looking for is to move all folders under
"C:\test\start\"
>  to "W:\test\finish\" across an NT network and also only move the folders
>  that have been modified 30 days from now.

What do you mean by: "modified 30 days from now"?

The folder has to be 30 days old or older or just older that 30 days (i.e.
31+)?

How about:

    Option Explicit

'===========================================================================
'
   '  "Qmovfold.vbs"    Date Created: 29-Jan-2003    Date Updated:
29-Jan-2003
   '
   '  This VBS (Visual Basic Script) program does the following:
   '  1)  Specify "cFO1" = "source" folder containing subfolders to move.
   '  2)  Specify "cFO2" = "destination" folder for source's subfolders.
   '  3)  Specify "cAGE" = "age" (in days) of subfolders to move.
   '  4)  Move subfolders from "source" to "destination" if "age" is valid.
   '
   '  To test, either double-click on the filename in Windows Explorer or
   '  from the Command prompt, type "cscript.exe //nologo Qmovfold.vbs".
   '
   '  Changes:

  -------------------------------------------------------------------------
   '  29-Jan-2003.0  Changed.
   '  29-Jan-2003.0  Created.
   '

'===========================================================================
'
    Const cVBS = "Qmovfold.vbs"
    Const cFO1 = "C:\test\start\"
    Const cFO2 = "W:\test\finish\"
    Const cAGE = 30 'days old
   '*
   '*  Start Message
   '*
    MsgBox "'" & cVBS & "' started."
   '*
   '*  Processing
   '*
    Call Processing()
   '*
   '*  Finish Message
   '*
    MsgBox "'" & cVBS & "' finished."

Sub Processing()
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim objGFO
    Dim objGF2
    Dim objGSF
   '*
   '*  Input Folder Exists?
   '*
    If Not objFSO.FolderExists(cFO1) Then
        MsgBox "Input folder doesn't exist! " & cFO1
        Exit Sub
    End If
   '*
   '*  Output Folder Exists?
   '*
    If Not objFSO.FolderExists(cFO2) Then
        MsgBox "Output folder doesn't exist! " & cFO2
        Exit Sub
    End If
   '*
   '*  Output Subfolders Exist?  (they must not)
   '*
    Set objGFO = objFSO.GetFolder(cFO2)
    If  objGFO.SubFolders.Count > 0 Then
        MsgBox "Output folder has subfolders! " & cFO1
        Exit Sub
    End If
   '*
   '*  Input Subfolders Exist?  (they must)
   '*
    Set objGFO = objFSO.GetFolder(cFO1)
    If  objGFO.SubFolders.Count = 0 Then
        MsgBox "Input folder has no subfolders! " & cFO1
        Exit Sub
    End If
   '*
   '*  Move Folders
   '*
    Set objGSF = objGFO.SubFolders
    Dim strGSF
    For Each strGSF in objGSF
        Set objGF2 = objFSO.GetFolder(cFO1 & strGSF.Name)
        If DateDiff("d",objGF2.DateLastModified,Now) > cAGE Then
'wscript.echo "MoveFolder " & cFO1 & strGSF.Name & "," & cFO2 & " (" &
DateDiff("d",objGF2.DateLastModified,Now) &  " days old)."
            objFSO.MoveFolder cFO1 & strGSF.Name, cFO2
        End If
        Set objGF2 = Nothing
    Next
    Set objGSF = Nothing
    Set objGFO = Nothing
    Set objFSO = Nothing
End Sub



Mon, 18 Jul 2005 07:02:54 GMT  
 VBS Question

Quote:

> I just can't seem to be able to move a directory with this script.

And what error number/message do you get?

Did you try this ???

objFSO.MoveFolder "C:\test\start\*.*" , "W:\"

(note the "\" in "W:\")

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US



Mon, 18 Jul 2005 09:30:39 GMT  
 VBS Question
I am getting "Microsoft VBScript runtime error: Permission denied" errors.



Quote:

> > I just can't seem to be able to move a directory with this script.

> And what error number/message do you get?

> Did you try this ???

> objFSO.MoveFolder "C:\test\start\*.*" , "W:\"

> (note the "\" in "W:\")

> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US



Wed, 20 Jul 2005 01:03:27 GMT  
 VBS Question
Oops forgot some stuff.  I am getting that error message (I am getting
"Microsoft VBScript runtime error: Permission denied" errors.) with this
script.

    Const cVBS = "Qmovfold.vbs"
    Const cFO1 = "C:\test\start\"
    Const cFO2 = "W:\test\"
    Const cAGE = 0 'days old
   '*
   '*  Start Message
   '*
    MsgBox "'" & cVBS & "' started."
   '*
   '*  Processing
   '*
    Call Processing()
   '*
   '*  Finish Message
   '*
    MsgBox "'" & cVBS & "' finished."

Sub Processing()
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Dim objGFO
    Dim objGF2
    Dim objGSF
   '*
   '*  Input Folder Exists?
   '*
    If Not objFSO.FolderExists(cFO1) Then
        MsgBox "Input folder doesn't exist! " & cFO1
        Exit Sub
    End If
   '*
   '*  Output Folder Exists?
   '*
    If Not objFSO.FolderExists(cFO2) Then
        MsgBox "Output folder doesn't exist! " & cFO2
        Exit Sub
    End If
   '*
   '*  Output Subfolders Exist?  (they must not)
   '*
    Set objGFO = objFSO.GetFolder(cFO2)
    If  objGFO.SubFolders.Count > 0 Then
        MsgBox "Output folder has subfolders! " & cFO1
        Exit Sub
    End If
   '*
   '*  Input Subfolders Exist?  (they must)
   '*
    Set objGFO = objFSO.GetFolder(cFO1)
    If  objGFO.SubFolders.Count = 0 Then
        MsgBox "Input folder has no subfolders! " & cFO1
        Exit Sub
    End If
   '*
   '*  Move Folders
   '*
    Set objGSF = objGFO.SubFolders
    Dim strGSF
    For Each strGSF in objGSF
        Set objGF2 = objFSO.GetFolder(cFO1 & strGSF.Name)
        If DateDiff("d",objGF2.DateLastModified,Now) > cAGE Then
wscript.echo "MoveFolder " & cFO1 & strGSF.Name & "," & cFO2 & " (" &
DateDiff("d",objGF2.DateLastModified,(Now)) &  " days old)."
            objFSO.MoveFolder cFO1 & strGSF.Name, cFO2
        End If
        Set objGF2 = Nothing
    Next
    Set objGSF = Nothing
    Set objGFO = Nothing
    Set objFSO = Nothing
End Sub


Quote:

> > I just can't seem to be able to move a directory with this script.

> And what error number/message do you get?

> Did you try this ???

> objFSO.MoveFolder "C:\test\start\*.*" , "W:\"

> (note the "\" in "W:\")

> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US



Wed, 20 Jul 2005 01:12:49 GMT  
 VBS Question

Quote:
> "Microsoft VBScript runtime error: Permission denied" errors.) with this
> script.

On what line?


Wed, 20 Jul 2005 01:58:43 GMT  
 VBS Question
Is "W:\" a mapped drive?

Minor note:
    "        MsgBox "Output folder has subfolders! " & cFO1"
should be
    "        MsgBox "Output folder has subfolders! " & cFO2"

Also, you removed "Option Explicit" from the script.



Wed, 20 Jul 2005 02:10:46 GMT  
 VBS Question

Sorry, this is the line (objFSO.MoveFolder cFO1 & strGSF.Name, cFO2) it's on
the bottom of the script.


Quote:
> > "Microsoft VBScript runtime error: Permission denied" errors.) with this
> > script.

> On what line?



Wed, 20 Jul 2005 02:47:04 GMT  
 VBS Question
Yes, "W:\" is a mapped NT4 drive.


Quote:
> Is "W:\" a mapped drive?

> Minor note:
>     "        MsgBox "Output folder has subfolders! " & cFO1"
> should be
>     "        MsgBox "Output folder has subfolders! " & cFO2"

> Also, you removed "Option Explicit" from the script.



Wed, 20 Jul 2005 02:53:29 GMT  
 VBS Question
What does the "wscript.echo" statement display?

wscript.echo "MoveFolder " & cFO1 & strGSF.Name & "," & cFO2 & " (" &
DateDiff("d",objGF2.DateLastModified,(Now)) &  " days old)."



Wed, 20 Jul 2005 03:27:14 GMT  
 
 [ 23 post ]  Go to page: [1] [2]

 Relevant Pages 

1. new to vbs question

2. vbs question

3. Some IE,VBS questions

4. Outlook and VBS question

5. Newbie VBS Question: How do I change the current (working) directory

6. Newbie VBS Question: How do I change the current (working) directory

7. Newbie question - calling a VBS script from another VBS script

8. Syntax checker for VBS and VBS grammar for YACC/LEX

9. Add computer in domain with vbs or tools call by vbs

10. Calling *.vbs files to Run From Master VBS File

11. how to call vbs file from vbs file

12. Running a .vbs script from within a .vbs script

 

 
Powered by phpBB® Forum Software