PC Review


Reply
Thread Tools Rate Thread

How to copy a hidden file

 
 
Wensi Peng
Guest
Posts: n/a
 
      13th Jan 2005
Hello,

How to have a VBscript or batch file to copy a hidden file from a server to
a remote server?

Thanks,
Wensi


 
Reply With Quote
 
 
 
 
David Wang [Msft]
Guest
Posts: n/a
 
      13th Jan 2005
1. Use FSO to unhide the file, copy it, re-hide it.
2. Shell out to XCOPY with the /h switch to copy hidden files.

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Wensi Peng" <(E-Mail Removed)> wrote in message
news:%23Y51JPS%(E-Mail Removed)...
Hello,

How to have a VBscript or batch file to copy a hidden file from a server to
a remote server?

Thanks,
Wensi



 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      13th Jan 2005
In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:

> Hello,
>
> How to have a VBscript or batch file to copy a hidden file from a
> server to a remote server?


XCOPY /?
...
/H Copies hidden and system files also.
...

 
Reply With Quote
 
Wensi Peng
Guest
Posts: n/a
 
      13th Jan 2005
I tried it and how to suppress the question F or D ? I know boot.ini is a
file.

I want xcopy run in a batch file.

I want the destination file removed hidden after copying. How?

Also how about using robocopy to do the same job?

Example:

E:\Documents and Settings\Max>xcopy /h /i c:\boot.ini c:\boot2.ini
Does C:\boot2.ini specify a file name
or directory name on the target
(F = file, D = directory)?



Thanks,

Wensi

"Mark V" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:
>
>> Hello,
>>
>> How to have a VBscript or batch file to copy a hidden file from a
>> server to a remote server?

>
> XCOPY /?
> ...
> /H Copies hidden and system files also.
> ...
>



 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      13th Jan 2005
In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:

> "Mark V" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:
>>
>>> Hello,
>>>
>>> How to have a VBscript or batch file to copy a hidden file from
>>> a server to a remote server?

>>
>> XCOPY /?
>> ...
>> /H Copies hidden and system files also.
>> ...


> I tried it and how to suppress the question F or D ? I know
> boot.ini is a file.
>
> I want xcopy run in a batch file.
>
> I want the destination file removed hidden after copying. How?
>
> Also how about using robocopy to do the same job?
>
> Example:
>
> E:\Documents and Settings\Max>xcopy /h /i c:\boot.ini c:\boot2.ini
> Does C:\boot2.ini specify a file name
> or directory name on the target
> (F = file, D = directory)?


You did not say your OS.

One way may be
echo/F|xcopy /h c:\boot.ini c:\boot2.ini
Attrib -s -h -r c:\boot2.ini

Or
attrib -s -h -r c:\boot.ini
copy c:\boot.ini c:\boot2.ini
attrib +s +h +r c:\boot.ini

I can't give you the robocopy syntax.
For other purposes XXcopy may be of interest.

 
Reply With Quote
 
Matthias Tacke
Guest
Posts: n/a
 
      13th Jan 2005
Wensi Peng wrote:
> Hello,
>
> How to have a VBscript or batch file to copy a hidden file from a server to
> a remote server?
>

Copied and tweaked from portable script center:
"Copying a File",
"Enumerating File Attributes" and
"Modifying File Atttributes""

'---------------------------------------------------
Dim Src, Dest, SrcAtt
Src="\\Server1\c$\boot.ini"
Dest="\\Server2\c$\boot2.ini"

Set objFSO = CreateObject("Scripting.FileSystemObject")

'copy file
Const OverwriteExisting = True
objFSO.CopyFile Src ,Dest , OverwriteExisting

' get source attributes
Set objFile = objFSO.GetFile(Src)
SrcAtt = objFile.Attributes

' set dest attributes
Set objFile = objFSO.GetFile(Dest)
objFile.Attributes = SrcAtt

set objFile = Nothing
'---------------------------------------------------

HTH

--
Gruesse Greetings Saludos Saluti Salutations
Matthias
---------+---------+---------+---------+---------+---------+---------+
 
Reply With Quote
 
Wensi Peng
Guest
Posts: n/a
 
      13th Jan 2005
My fist question was:

when I run the command "xcopy /h /i c:\boot.ini c:\boot2.ini" I am prompted
if boot2.ini is a File or Directory.
It requires interactive work. How can I suppress the question?

Thanks,
Wensi

"Mark V" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:
>
> > "Mark V" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >
> >> In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:
> >>
> >>> Hello,
> >>>
> >>> How to have a VBscript or batch file to copy a hidden file from
> >>> a server to a remote server?
> >>
> >> XCOPY /?
> >> ...
> >> /H Copies hidden and system files also.
> >> ...

>
> > I tried it and how to suppress the question F or D ? I know
> > boot.ini is a file.
> >
> > I want xcopy run in a batch file.
> >
> > I want the destination file removed hidden after copying. How?
> >
> > Also how about using robocopy to do the same job?
> >
> > Example:
> >
> > E:\Documents and Settings\Max>xcopy /h /i c:\boot.ini c:\boot2.ini
> > Does C:\boot2.ini specify a file name
> > or directory name on the target
> > (F = file, D = directory)?

>
> You did not say your OS.
>
> One way may be
> echo/F|xcopy /h c:\boot.ini c:\boot2.ini
> Attrib -s -h -r c:\boot2.ini
>
> Or
> attrib -s -h -r c:\boot.ini
> copy c:\boot.ini c:\boot2.ini
> attrib +s +h +r c:\boot.ini
>
> I can't give you the robocopy syntax.
> For other purposes XXcopy may be of interest.
>



 
Reply With Quote
 
Wensi Peng
Guest
Posts: n/a
 
      13th Jan 2005
Thanks for your post.
I prefer to use xcopy. The problem is I am prompted to ask if a destination
is a file or directory.
I wan to suppress the interactive question in a batch file.

Thanks,
Wensi
"Matthias Tacke" <(E-Mail Removed)> wrote in message
news:cs65f8$io3$00$(E-Mail Removed)...
> Wensi Peng wrote:
> > Hello,
> >
> > How to have a VBscript or batch file to copy a hidden file from a server

to
> > a remote server?
> >

> Copied and tweaked from portable script center:
> "Copying a File",
> "Enumerating File Attributes" and
> "Modifying File Atttributes""
>
> '---------------------------------------------------
> Dim Src, Dest, SrcAtt
> Src="\\Server1\c$\boot.ini"
> Dest="\\Server2\c$\boot2.ini"
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
>
> 'copy file
> Const OverwriteExisting = True
> objFSO.CopyFile Src ,Dest , OverwriteExisting
>
> ' get source attributes
> Set objFile = objFSO.GetFile(Src)
> SrcAtt = objFile.Attributes
>
> ' set dest attributes
> Set objFile = objFSO.GetFile(Dest)
> objFile.Attributes = SrcAtt
>
> set objFile = Nothing
> '---------------------------------------------------
>
> HTH
>
> --
> Gruesse Greetings Saludos Saluti Salutations
> Matthias
> ---------+---------+---------+---------+---------+---------+---------+



 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      13th Jan 2005
In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:

> My fist question was:
>
> when I run the command "xcopy /h /i c:\boot.ini c:\boot2.ini" I am
> prompted if boot2.ini is a File or Directory.
> It requires interactive work. How can I suppress the question?


Which was my first answer... :-)

>
> Thanks,
> Wensi
>
> "Mark V" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:
>>
>> > "Mark V" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> >
>> >> In microsoft.public.win2000.cmdprompt.admin Wensi Peng wrote:
>> >>
>> >>> Hello,
>> >>>
>> >>> How to have a VBscript or batch file to copy a hidden file
>> >>> from a server to a remote server?
>> >>
>> >> XCOPY /?
>> >> ...
>> >> /H Copies hidden and system files also.
>> >> ...

>>
>> > I tried it and how to suppress the question F or D ? I know
>> > boot.ini is a file.
>> >
>> > I want xcopy run in a batch file.
>> >
>> > I want the destination file removed hidden after copying. How?
>> >
>> > Also how about using robocopy to do the same job?
>> >
>> > Example:
>> >
>> > E:\Documents and Settings\Max>xcopy /h /i c:\boot.ini
>> > c:\boot2.ini Does C:\boot2.ini specify a file name
>> > or directory name on the target
>> > (F = file, D = directory)?

>>
>> You did not say your OS.
>>
>> One way may be
>> echo/F|xcopy /h c:\boot.ini c:\boot2.ini
>> Attrib -s -h -r c:\boot2.ini
>>
>> Or
>> attrib -s -h -r c:\boot.ini
>> copy c:\boot.ini c:\boot2.ini
>> attrib +s +h +r c:\boot.ini
>>
>> I can't give you the robocopy syntax.
>> For other purposes XXcopy may be of interest.
>>

>
>


 
Reply With Quote
 
Matthias Tacke
Guest
Posts: n/a
 
      13th Jan 2005
Wensi Peng wrote:
> "Matthias Tacke" <(E-Mail Removed)> wrote in message
>>Wensi Peng wrote:
>>>How to have a VBscript or batch file to copy a hidden file from a server

>

You should state that in your question then.
Why dd you crosspost to a vbscript group when you aren't interrestes in a
vbs solution?

> Thanks for your post.
> I prefer to use xcopy. The problem is I am prompted to ask if a destination
> is a file or directory.
> I wan to suppress the interactive question in a batch file.
>

Looks like you didn't even try one of Marks work arounds.

--
Gruesse Greetings Saludos Saluti Salutations
Matthias
---------+---------+---------+---------+---------+---------+---------+
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and Paste with hidden columns remaining hidden Pendelfin Microsoft Excel Misc 2 26th Feb 2009 11:35 AM
Hidden file list during copy or move attempt =?Utf-8?B?bGJuMTEyNA==?= Windows XP General 10 19th Aug 2006 05:42 AM
File Copy to Hidden Share AdrianJMartin Microsoft C# .NET 2 23rd Nov 2005 01:23 AM
Copy hidden/system file not allowed? Tim Johnson Microsoft Dot NET Compact Framework 2 2nd Nov 2005 03:39 PM
Keeping hidden columns HIDDEN in a copy-and-paste leojbramble Microsoft Excel Discussion 1 21st Oct 2003 05:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:20 AM.