Computing.Net > Forums > Programming > vb script path problem (wildcard)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

vb script path problem (wildcard)

Reply to Message Icon

Name: indiewolf
Date: July 27, 2006 at 06:26:03 Pacific
OS: win xp
CPU/Ram: 512
Product: hp
Comment:

Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objShell=CreateObject("WScript.Shell")


Source = "C:\Documents and Settings\user\Desktop\clients\****\t"
Set fileLocation=objFSO.GetFolder(Source)
Destination = "c:\y\"
SubFolderCopy fileLocation
Sub SubFileCopy (fileDir)
on error resume Next
For Each efile in fileDir.Files
objfso.copyfile efile, Destination
objfso.deletefile efile
msgbox ("Files Moved !")
Next
End Sub

Sub SubFolderCopy (fileDir)
SubFileCopy fileDir
For Each efolder In fileDir.subfolders
on Error Resume next
SubFolderCopy efolder
Next
End Sub

the above code basically moves the files from a folder to another folder.
it works fine for moving from a defined path.
but in my path if one of the folder is contantly changing and i only want to move the files of the folder and subfolders after this folder what should i do?
for eg. in the code above what should i do to replace those ***** with something(to automate the selection of that folder ) so that it directly copies the files from the fodler "t" and subfolders of it to c:\y.

kindly help/
also my message box does not close after clicking ok, i have to pres ok 3-4 times to close it. what can be the problem.

cheers



Sponsored Link
Ads by Google

Response Number 1
Name: indiewolf
Date: July 27, 2006 at 06:49:10 Pacific
Reply:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/2b6287d7-a6e3-40b5-97e4-899932059b28.asp


this link aint useful but has something thati want.
somebody please help
cheers


0
Reply to Message Icon

Related Posts

See More


Dos Bat. to edit file (ho... equivalent command for 's...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: vb script path problem (wildcard)

Interaction between C and VB script www.computing.net/answers/programming/interaction-between-c-and-vb-script/14575.html

Directories listing in VB script www.computing.net/answers/programming/directories-listing-in-vb-script/15485.html

VB script to change favorites path www.computing.net/answers/programming/vb-script-to-change-favorites-path/13780.html