asldesktop
IS-IT--Management
Hi
I must point out that I am a novice when it comes to scripting - I can usually get myself through things but I am stuck with this one.
I am attempting to write a script to do the following:
1. Create a folder, the name of which is input in to an inputbox
2. Move the contents of a directory (files & subfolders) in to the newly created subfolder
Sounds simple to me. I have been able to get the part working to create a folder named from an inputbox but not the folder/file move - I get an error 800A004C "Path not found"
Here is the script I have:
************************************************
'Create the file system object for creating folders
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Create A Folder With A Name Given By The User
ParentFolder = "C:\"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.NameSpace(ParentFolder)
foldername=inputbox ("Enter Folder Name")
objFolder.NewFolder (foldername)
'Move the files and folders in to the new folder
objFSO.MoveFile "C:\logon\*.*" , "foldername"
objFSO.MoveFolder "C:\logon\*.*" , "foldername"
************************************************
Is anyone able to provide assistance so I am able to get this working please? Any help is greatly appreciated!
Thanks
Paul
I must point out that I am a novice when it comes to scripting - I can usually get myself through things but I am stuck with this one.
I am attempting to write a script to do the following:
1. Create a folder, the name of which is input in to an inputbox
2. Move the contents of a directory (files & subfolders) in to the newly created subfolder
Sounds simple to me. I have been able to get the part working to create a folder named from an inputbox but not the folder/file move - I get an error 800A004C "Path not found"
Here is the script I have:
************************************************
'Create the file system object for creating folders
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Create A Folder With A Name Given By The User
ParentFolder = "C:\"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.NameSpace(ParentFolder)
foldername=inputbox ("Enter Folder Name")
objFolder.NewFolder (foldername)
'Move the files and folders in to the new folder
objFSO.MoveFile "C:\logon\*.*" , "foldername"
objFSO.MoveFolder "C:\logon\*.*" , "foldername"
************************************************
Is anyone able to provide assistance so I am able to get this working please? Any help is greatly appreciated!
Thanks
Paul