![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Duplicating Directory Trees Just updated the "Chronicles of a Script" post Anyway, you can duplicate an exisiting directory tree (folders only) to another location with this command Copy-Item $env:windir -filter {$_.PSIsContainer} d:\testingpath -recurse -force $hay http://scriptolog.blogspot.com |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Duplicating Directory Trees "$hay" <no@addre.ss> wrote in message news:OoAOyFbNHHA.4992@TK2MSFTNGP04.phx.gbl... > Just updated the "Chronicles of a Script" post > Anyway, you can duplicate an exisiting directory tree (folders only) > to another location with this command > > Copy-Item $env:windir -filter {$_.PSIsContainer} > d:\testingpath -recurse -force This command does the same thing: Copy-Item $env:windir -filter {$null} d:\testingpath -recurse -force I don't think the scriptblock you are specifying for -filter is behaving like you think it is. -- Keith |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Duplicating Directory Trees "Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote in message news:OWcFOTbNHHA.1240@TK2MSFTNGP03.phx.gbl... > "$hay" <no@addre.ss> wrote in message > news:OoAOyFbNHHA.4992@TK2MSFTNGP04.phx.gbl... >> Just updated the "Chronicles of a Script" post >> Anyway, you can duplicate an exisiting directory tree (folders only) >> to another location with this command >> >> Copy-Item $env:windir -filter {$_.PSIsContainer} >> d:\testingpath -recurse -force > > This command does the same thing: > > Copy-Item $env:windir -filter {$null} d:\testingpath -recurse -force And so does this: Copy-Item $env:windir -filter '$null' d:\testingpath -recurse -force The parameter type of -filter is string, so when you specify a scriptblock I think you are getting just the "ToString()" representation of the scriptblock e.g.: 344> {$_.PSIsContainer}.ToString() $_.PSIsContainer What made me wonder on this is that you were using $_ which in the context of your command wouldn't represent a valid value i.e. the command starts the pipeline and doesn't receive pipeline objects. -- Keith |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Duplicating Directory Trees OK, Keith, I'll bite. copy-item $env:windir -filter "anything" -destination C:\TestingPath6 -force -recurse also copies directories only. Yet if you omit the filter parameter files are copied too. Do you understand why? At the moment I can't figure it out. Andrew Watt MVP On Thu, 11 Jan 2007 12:20:52 -0700, "Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote: >"Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote in >message news:OWcFOTbNHHA.1240@TK2MSFTNGP03.phx.gbl... >> "$hay" <no@addre.ss> wrote in message >> news:OoAOyFbNHHA.4992@TK2MSFTNGP04.phx.gbl... >>> Just updated the "Chronicles of a Script" post >>> Anyway, you can duplicate an exisiting directory tree (folders only) >>> to another location with this command >>> >>> Copy-Item $env:windir -filter {$_.PSIsContainer} >>> d:\testingpath -recurse -force >> >> This command does the same thing: >> >> Copy-Item $env:windir -filter {$null} d:\testingpath -recurse -force > >And so does this: > >Copy-Item $env:windir -filter '$null' d:\testingpath -recurse -force > >The parameter type of -filter is string, so when you specify a scriptblock I >think you are getting just the "ToString()" representation of the >scriptblock e.g.: > >344> {$_.PSIsContainer}.ToString() >$_.PSIsContainer > >What made me wonder on this is that you were using $_ which in the context >of your command wouldn't represent a valid value i.e. the command starts the >pipeline and doesn't receive pipeline objects. |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Duplicating Directory Trees copy-item $env:windir -filter *.* -destination C:\TestingPath6 -force -recurse certainly did the job. I have messed with the -exclude parameter instead, using various options and it didn't worked. guess i walked the wrong path Cheers $hay "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message news:6d7dq2ltm5sceo2rm93trd9mv49p2h0ujf@4ax.com... > OK, Keith, I'll bite. > > copy-item $env:windir -filter "anything" -destination C:\TestingPath6 > -force -recurse > > also copies directories only. > > Yet if you omit the filter parameter files are copied too. > > Do you understand why? At the moment I can't figure it out. > > Andrew Watt MVP > > On Thu, 11 Jan 2007 12:20:52 -0700, "Keith Hill [MVP]" > <r_keith_hill@no.spam.thank.u.hotmail.com> wrote: > >>"Keith Hill [MVP]" <r_keith_hill@no.spam.thank.u.hotmail.com> wrote in >>message news:OWcFOTbNHHA.1240@TK2MSFTNGP03.phx.gbl... >>> "$hay" <no@addre.ss> wrote in message >>> news:OoAOyFbNHHA.4992@TK2MSFTNGP04.phx.gbl... >>>> Just updated the "Chronicles of a Script" post >>>> Anyway, you can duplicate an exisiting directory tree (folders only) >>>> to another location with this command >>>> >>>> Copy-Item $env:windir -filter {$_.PSIsContainer} >>>> d:\testingpath -recurse -force >>> >>> This command does the same thing: >>> >>> Copy-Item $env:windir -filter {$null} d:\testingpath -recurse -force >> >>And so does this: >> >>Copy-Item $env:windir -filter '$null' d:\testingpath -recurse -force >> >>The parameter type of -filter is string, so when you specify a scriptblock >>I >>think you are getting just the "ToString()" representation of the >>scriptblock e.g.: >> >>344> {$_.PSIsContainer}.ToString() >>$_.PSIsContainer >> >>What made me wonder on this is that you were using $_ which in the context >>of your command wouldn't represent a valid value i.e. the command starts >>the >>pipeline and doesn't receive pipeline objects. |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: Duplicating Directory Trees "Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message news:6d7dq2ltm5sceo2rm93trd9mv49p2h0ujf@4ax.com... > OK, Keith, I'll bite. > > copy-item $env:windir -filter "anything" -destination C:\TestingPath6 > -force -recurse > > also copies directories only. > > Yet if you omit the filter parameter files are copied too. > > Do you understand why? At the moment I can't figure it out. Neither can I. :-( -- Keith |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| duplicating of photos when sending e-mail | mikeygit | Vista mail | 3 | 02-24-2008 04:28 PM |
| Duplicating Quick Launch Toolbar | Mitch | Vista General | 5 | 01-10-2008 04:21 PM |
| Duplicating pictures | RP50 | Vista music pictures video | 6 | 10-25-2007 07:00 PM |
| Contacts folder duplicating itself? | Tessiero | Vista General | 1 | 10-01-2007 04:01 PM |
| Horizonal Autoscroll of trees is the WORST new Vista feature | MichaelDouglasKrause | Vista General | 19 | 09-19-2007 05:20 PM |