How to keep source attributes copying folders

October 13, 2010 at 04:33:11
Specs: Windows XP-Pro SP3, 2.0 GHz, 512MB
How can I copy files and folders keeping source attributes?

I have XP-Pro SP3 with Power Shell installed.

I need a script I can drag and drop files and folders onto that will copy them maintaining the attributes of the source.

Specifically most of my folders have distributable custom icons. Each folder contains both a "desktop.ini" file and an associated "FolderMarker.ico" the "desktop.ini" file points to. Both of these files have "system" and "hidden" attributes. In order for the folders to display the custom icons when copied to another computer these files have to keep the "system" attribute and I want the "hidden" attribute maintained as well.

I haven't been able to do this using VBscript. I have to use XXcopy which doesn't allow me to copy by just dropping the folders on the script. (VBscript does allow me to copy by dropping items on the script but the copied folder icons are not distributable because the "system" and "hidden" attributes of the "desktop.ini" and "FolderMarker.ico" are lost when copied by that method.

I would really appreciate a script to accomplish this. Below is the VBscript to which I refer. Thanks.


-----------------------------------------------

On Error Resume Next
Const OverwriteExisting = True
Set objArgs = WScript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objArgs.Count < 1 Then
WScript.Quit
End If
For I = 0 to objArgs.Count - 1

Arg = objArgs(I)

objFSO.CopyFile Arg, "C:\Program Files\", OverwriteExisting
objFSO.CopyFile Arg, "D:\0 aAPPS\00 a Install First\Program Files\", OverwriteExisting
objFSO.CopyFolder Arg, "C:\Program Files\", OverwriteExisting
objFSO.CopyFolder Arg, "D:\0 aAPPS\00 a Install First\Program Files\", OverwriteExisting

Next
WScript.Quit

-----------------------------------------------


See More: How to keep source attributes copying folders

Report •

#1
October 13, 2010 at 05:05:28
XCOPY /A ???

Happy is ONE who says I am an OttoMAN.


Report •

#2
October 13, 2010 at 08:18:29
"I have to use XXcopy which doesn't allow me to copy by just dropping the folders on the script."

Report •

#3
October 14, 2010 at 09:11:28
If it's just the "desktop.ini" file, why not just turn on the Hidden and System attributes after the copy?

How To Ask Questions The Smart Way


Report •

Related Solutions

#4
October 17, 2010 at 16:17:49
PROBLEM SOLVED ON ANOTHER FORUM
THE SCRIPT PROVIDED WORKS PERFECTLY

Here is the link:

http://www.theeldergeek.com/forum/i...


Report •

Ask Question