![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 |
| | #2 (permalink) |
| Guest | Re: Chronicles of a Script Good stuff but this should be easier in PowerShell. Maybe you should request the /T functionaility be available in copy-item. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
| | #3 (permalink) |
| Guest | Re: Chronicles of a Script "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message news:A73A47F0-2467-445C-B05C-A8F6B4C9A4C9@microsoft.com... > Good stuff but this should be easier in PowerShell. Maybe you should > request the /T functionaility be available in copy-item. Agreed. The -recurse feature on copy-item works good if you want to copy a "dir" and retain the dir structure. But if you want to copy the "contents" of a dir to another existing dir and retain the directory structure, it doesn't work. This definitely should be easy in PoSH. -- Keith |
| | #4 (permalink) |
| Guest | Re: Chronicles of a Script 10x guys, i hope its not a case of misunderstanding. The whole thing is about duplicating source directory tree to another location WITHOUT the files. (so if it is, plz specify it in your replies, so ill can clarify myself and correct the text :-). Now, correct me if im wrong : - I have to use a cmdlet (either copy-item or new-item). - In both cmdlets the -recurse will be on - Distinguish between file items or directory have to be checked. How can i make it easier/shorter? $hay "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:eb$7IpQLHHA.4992@TK2MSFTNGP04.phx.gbl... > "Jeffrey Snover [MSFT]" <jsnover@ntdev.microsoft.com> wrote in message > news:A73A47F0-2467-445C-B05C-A8F6B4C9A4C9@microsoft.com... >> Good stuff but this should be easier in PowerShell. Maybe you should >> request the /T functionaility be available in copy-item. > > Agreed. The -recurse feature on copy-item works good if you want to copy > a "dir" and retain the dir structure. But if you want to copy the > "contents" of a dir to another existing dir and retain the directory > structure, it doesn't work. This definitely should be easy in PoSH. > > -- > Keith > |
| | #5 (permalink) |
| Guest | Re: Chronicles of a Script "$hay" <no@addre.ss> wrote in message news:OW8ujNRLHHA.420@TK2MSFTNGP06.phx.gbl... > 10x guys, i hope its not a case of misunderstanding. The whole thing is > about duplicating > source directory tree to another location WITHOUT the files. (so if it is, > plz specify it > in your replies, so ill can clarify myself and correct the text :-). > > Now, correct me if im wrong : > > - I have to use a cmdlet (either copy-item or new-item). > - In both cmdlets the -recurse will be on > - Distinguish between file items or directory have to be checked. > > How can i make it easier/shorter? > > $hay To be clear for folks reading this, copying one directory to another existing or non-existing dir is easy: Copy-Item SrcDir ExistingDestDir -rec this will copy the SrcDir and all its contents under ExistingDestDir Copy-Item SrcDir NonExistingDestDir -rec this will copy SrcDir and all its contents to a newly created dest dir with the same leaf dir name as the SrcDir. Even copying the contents of a dir (recursively) is easy e.g.: Copy-Item SrcDir\* ExistingDestDir -rec What is proving painful is copying just the contents of the src dir while filtering what is copied: Copy-Item SrcDir\* ExistingDestDir -rec -filter *.txt The above doesn't work, it copies nothing to the dest dir. However copying the SrcDir itself does work with -filter: Copy-Item SrcDir Existing(OrNonExisting)DestDir -rec -filter *.txt So if the dest dir doesn't exist, you king of get the equivalent of copying the contents with filtering enabled. You would then need to move that new directories contents to the desired location e.g.: $tempDestDir = $env:Temp\<someTempDirName> md $tempDestDir Copy-Item SrcDir $tempDestDir -rec -filter *.txt Move-Item $tempDestDir \* $destDir Remove-Item $tempDestDir -rec -force So yeah this one use case is definitely harder than it should be in PoSH. -- Keith |
| | #6 (permalink) |
| Guest | Re: Chronicles of a Script I submitted this a bug: https://connect.microsoft.com/feedba...9114&SiteID=99 Vote on it if you can. -- Keith |
| | #7 (permalink) |
| Guest | Re: Chronicles of a Script 10x Keith "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:u1adkhRLHHA.1008@TK2MSFTNGP06.phx.gbl... "$hay" <no@addre.ss> wrote in message news:OW8ujNRLHHA.420@TK2MSFTNGP06.phx.gbl... > 10x guys, i hope its not a case of misunderstanding. The whole thing is > about duplicating > source directory tree to another location WITHOUT the files. (so if it is, > plz specify it > in your replies, so ill can clarify myself and correct the text :-). > > Now, correct me if im wrong : > > - I have to use a cmdlet (either copy-item or new-item). > - In both cmdlets the -recurse will be on > - Distinguish between file items or directory have to be checked. > > How can i make it easier/shorter? > > $hay To be clear for folks reading this, copying one directory to another existing or non-existing dir is easy: Copy-Item SrcDir ExistingDestDir -rec this will copy the SrcDir and all its contents under ExistingDestDir Copy-Item SrcDir NonExistingDestDir -rec this will copy SrcDir and all its contents to a newly created dest dir with the same leaf dir name as the SrcDir. Even copying the contents of a dir (recursively) is easy e.g.: Copy-Item SrcDir\* ExistingDestDir -rec What is proving painful is copying just the contents of the src dir while filtering what is copied: Copy-Item SrcDir\* ExistingDestDir -rec -filter *.txt The above doesn't work, it copies nothing to the dest dir. However copying the SrcDir itself does work with -filter: Copy-Item SrcDir Existing(OrNonExisting)DestDir -rec -filter *.txt So if the dest dir doesn't exist, you king of get the equivalent of copying the contents with filtering enabled. You would then need to move that new directories contents to the desired location e.g.: $tempDestDir = $env:Temp\<someTempDirName> md $tempDestDir Copy-Item SrcDir $tempDestDir -rec -filter *.txt Move-Item $tempDestDir \* $destDir Remove-Item $tempDestDir -rec -force So yeah this one use case is definitely harder than it should be in PoSH. -- Keith |
| | #8 (permalink) |
| Guest | Re: Chronicles of a Script just visited the link. FYI, after logging with my passport i get an error from microsoft: page noe found. hope this is not my inernet connection :-) "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:uvcEiAXLHHA.4916@TK2MSFTNGP06.phx.gbl... I submitted this a bug: https://connect.microsoft.com/feedba...9114&SiteID=99 Vote on it if you can. -- Keith |
| | #9 (permalink) |
| Guest | Re: Chronicles of a Script I'm not sure that the PowerShell project on the connect site is open to join anymore. Did you try to join the project? If it is true that it isn't open to join anymore then this leaves new users with no place to submit feedback. -- Keith "$hay" <no@addre.ss> wrote in message news:eZ57mFYLHHA.420@TK2MSFTNGP06.phx.gbl... just visited the link. FYI, after logging with my passport i get an error from microsoft: page noe found. hope this is not my inernet connection :-) "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:uvcEiAXLHHA.4916@TK2MSFTNGP06.phx.gbl... I submitted this a bug: https://connect.microsoft.com/feedba...9114&SiteID=99 Vote on it if you can. -- Keith |
| | #10 (permalink) |
| Guest | Re: Chronicles of a Script i did join some other projects earlier, but i cant find any reference to PowerShell's. $hay "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:u5g2ULYLHHA.2140@TK2MSFTNGP03.phx.gbl... I'm not sure that the PowerShell project on the connect site is open to join anymore. Did you try to join the project? If it is true that it isn't open to join anymore then this leaves new users with no place to submit feedback. -- Keith "$hay" <no@addre.ss> wrote in message news:eZ57mFYLHHA.420@TK2MSFTNGP06.phx.gbl... just visited the link. FYI, after logging with my passport i get an error from microsoft: page noe found. hope this is not my inernet connection :-) "Keith Hill [MVP]" <r_keith_hill@mailhot.moc.nospam> wrote in message news:uvcEiAXLHHA.4916@TK2MSFTNGP06.phx.gbl... I submitted this a bug: https://connect.microsoft.com/feedba...9114&SiteID=99 Vote on it if you can. -- Keith |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Myst Uru Complete Chronicles, HELP PLEASE! | Dustmover | Gaming | 7 | 1 Week Ago 09:03 PM |
| Include another script, keep variables in included script? | pschmidt | PowerShell | 32 | 2 Weeks Ago 01:48 PM |
| Uru complete chronicles | phypps | Vista Games | 0 | 03-13-2008 10:33 AM |
| Script file has 'OS Handle' error when run from script | Jay | PowerShell | 1 | 09-18-2007 07:06 PM |
| Can you drag-n-drop a file on top of a PS script to run the script? | Jen Taylor | PowerShell | 6 | 04-06-2007 09:02 AM |