Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use VBScript to Copy Hidden Folders 1

Status
Not open for further replies.

MattGreer

Technical User
Joined
Feb 19, 2004
Messages
471
Location
US
I'm fairly familiar with VBScript but I cannot seem to create a script to copy the contents of a hidden folder.

I'm creating a backup script for my profile to copy certain things onto a mapped network share. They backup the network share.

I'm having trouble copying stuff out of the 'Application Data' folder, which is by default, hidden.

I'd rather not unhide the folder and then re-hide it for the purposes of this script, but I guess if I have to I will.





Thanks!!


Matt
 
You can't use the GetFolder method with a hidden folder name as argument ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I was using the CopyFolder method to copy the folder and any files contained therein.

The folder in question is the 'Application Data' folder in my profile:

Code:
fso.CopyFolder "C:\Documents and Settings\mgreer\Application Data\Microsoft\Signatures\*", "G:\mgreer\Application Data\Microsoft\Signatures\", OverWriteFiles

All the folders exist, but somehow I still get an error when I run the script.

The error is:

Line: 13
Char: 2
Error: Path not found

Thanks!!


Matt
 
And this ?
fso.CopyFolder "C:\Documents and Settings\mgreer\Application Data\Microsoft\Signatures", "G:\mgreer\Application Data\Microsoft\Signatures", True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I have the Const OverWriteFiles = True in the script.

The error I listed is on the line of code that I posted.

Any ideas? The 'Application Data' folder is hidden in both the source and destination. It exists in both places. I don't believe that the existence of both folders is causing the problem, and if it is then I've got a problem because this is a backup script. I don't want to have to delete the backup every time I run it.

Thanks!!


Matt
 
My suggestion was to remove the wildcar:
fso.CopyFolder "C:\Documents and Settings\mgreer\Application Data\Microsoft\Signatures", "G:\mgreer\Application Data\Microsoft\Signatures", OverWriteFiles

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That did it! However, the "\" is necessary on the second argument of the CopyFolder method. What happened was that the folder 'Signatures' was copied into the folder 'Signatures'. My mistake. I fixed this with this code:

fso.CopyFolder "C:\Documents and Settings\mgreer\Application Data\Microsoft\Signatures", "G:\mgreer\Application Data\Microsoft\", OverWriteFiles

Thank you so much! Actually, thank you on behalf of all the folks around here that will benefit from this script. :)

Thanks!!


Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top