In VBS how do you make a directory and then copy a file into it?
Id like to make a folder in the root of C e.g. C:\folder and then copy a file from \server\folder\file.ext into that new folder
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
FileSystemObjectobject, namely, itsCreateFolderandCopyFilemethods. Basically, this is what your script will look like:You may also want to add additional logic, like checking whether the folder you want to create already exists (because
CreateFolderraises an error in this case) or specifying whether or not to overwrite the file being copied. So, you can end up with this: