![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | Weird behavior using -Include switch on Get-ChildItem on local dir I have two directories that are identical including file timestamps. One directory is on a remote computer and the other directory is on my local pc. When I get the directory listing and use the -Include filter, I get different results: Local machine: ------------------ Command: Get-ChildItem c:\mydir\ -Include *.wav Result: No files returned Remote machine: -------------------- Command: Get-ChildItem \\remotemachine\mydir -Include *.wav Result: Returns all the files that match the *.wav mask Other than the path to the directory, these commands are identical. What I don't understand is why the behavior is different from the remote machine to the local machine. To make matters more confusing, the following command works as expected on the local machine: Get-ChildItem *.wav What is it that I don't understand about the -Include switch? Thanks, Don |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Weird behavior using -Include switch on Get-ChildItem on local dir It seems to work with -include on both local and remote machines if the path specification ends mydir\* This is sort of hinted at in the documentation where is says The Include parameter is effective only when the command includes the Recurse parameter or the path leads to the contents of a directory, such as C:\Windows\*, where the wildcard character specifies the contents of the C:\Windows directory. -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Don Dally" wrote: > I have two directories that are identical including file timestamps. One > directory is on a remote computer and the other directory is on my local pc. > When I get the directory listing and use the -Include filter, I get different > results: > > Local machine: > ------------------ > Command: Get-ChildItem c:\mydir\ -Include *.wav > Result: No files returned > > Remote machine: > -------------------- > Command: Get-ChildItem \\remotemachine\mydir -Include *.wav > Result: Returns all the files that match the *.wav mask > > Other than the path to the directory, these commands are identical. What I > don't understand is why the behavior is different from the remote machine to > the local machine. > > To make matters more confusing, the following command works as expected on > the local machine: > > Get-ChildItem *.wav > > What is it that I don't understand about the -Include switch? > > Thanks, > > Don > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Weird behavior using -Include switch on Get-ChildItem on local dir Rich, Thanks. I missed that in the documentation. The addition of the wildcard on the parent object gave me the results I expected. Now the only curiosity I have is why is the behavior inconsistent when dealing with a remote directory? Don "RichS" <RichS@discussions.microsoft.com> wrote in message news:36B45FB8-F789-4350-809D-2242FC4CCFA6@microsoft.com... > It seems to work with -include on both local and remote machines if the > path > specification ends mydir\* > > This is sort of hinted at in the documentation where is says > > The Include parameter is effective only when the command includes the > Recurse parameter or the path leads to the contents of a directory, such > as > C:\Windows\*, where the wildcard character specifies the contents of the > C:\Windows directory. > > > -- > Richard Siddaway > > Please note that all scripts are supplied "as is" and with no warranty > > > "Don Dally" wrote: > >> I have two directories that are identical including file timestamps. One >> directory is on a remote computer and the other directory is on my local >> pc. >> When I get the directory listing and use the -Include filter, I get >> different >> results: >> >> Local machine: >> ------------------ >> Command: Get-ChildItem c:\mydir\ -Include *.wav >> Result: No files returned >> >> Remote machine: >> -------------------- >> Command: Get-ChildItem \\remotemachine\mydir -Include *.wav >> Result: Returns all the files that match the *.wav mask >> >> Other than the path to the directory, these commands are identical. What >> I >> don't understand is why the behavior is different from the remote machine >> to >> the local machine. >> >> To make matters more confusing, the following command works as expected >> on >> the local machine: >> >> Get-ChildItem *.wav >> >> What is it that I don't understand about the -Include switch? >> >> Thanks, >> >> Don >> |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Weird behavior using -Include switch on Get-ChildItem on local I'm not able to duplicate the remote machine returning information without the wildcard on the end of the path are you using RTM PowerShell? If I use filter instead of include it doesn't matter whether the widcard is present or not -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Don Dally" wrote: > Rich, > > Thanks. I missed that in the documentation. The addition of the wildcard on > the parent object gave me the results I expected. > > Now the only curiosity I have is why is the behavior inconsistent when > dealing with a remote directory? > > Don > > > "RichS" <RichS@discussions.microsoft.com> wrote in message > news:36B45FB8-F789-4350-809D-2242FC4CCFA6@microsoft.com... > > It seems to work with -include on both local and remote machines if the > > path > > specification ends mydir\* > > > > This is sort of hinted at in the documentation where is says > > > > The Include parameter is effective only when the command includes the > > Recurse parameter or the path leads to the contents of a directory, such > > as > > C:\Windows\*, where the wildcard character specifies the contents of the > > C:\Windows directory. > > > > > > -- > > Richard Siddaway > > > > Please note that all scripts are supplied "as is" and with no warranty > > > > > > "Don Dally" wrote: > > > >> I have two directories that are identical including file timestamps. One > >> directory is on a remote computer and the other directory is on my local > >> pc. > >> When I get the directory listing and use the -Include filter, I get > >> different > >> results: > >> > >> Local machine: > >> ------------------ > >> Command: Get-ChildItem c:\mydir\ -Include *.wav > >> Result: No files returned > >> > >> Remote machine: > >> -------------------- > >> Command: Get-ChildItem \\remotemachine\mydir -Include *.wav > >> Result: Returns all the files that match the *.wav mask > >> > >> Other than the path to the directory, these commands are identical. What > >> I > >> don't understand is why the behavior is different from the remote machine > >> to > >> the local machine. > >> > >> To make matters more confusing, the following command works as expected > >> on > >> the local machine: > >> > >> Get-ChildItem *.wav > >> > >> What is it that I don't understand about the -Include switch? > >> > >> Thanks, > >> > >> Don > >> > > > |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Weird behavior using -Include switch on Get-ChildItem on local I am running the RTM version. Is using filter functionally the same as -Include? If not, do you know the differences? "RichS" <RichS@discussions.microsoft.com> wrote in message news 3B7C47C-B0BE-4CFC-B954-855D3BEE4A29@microsoft.com...> I'm not able to duplicate the remote machine returning information without > the wildcard on the end of the path are you using RTM PowerShell? If I > use > filter instead of include it doesn't matter whether the widcard is present > or > not > -- > Richard Siddaway > > Please note that all scripts are supplied "as is" and with no warranty > > > "Don Dally" wrote: > >> Rich, >> >> Thanks. I missed that in the documentation. The addition of the wildcard >> on >> the parent object gave me the results I expected. >> >> Now the only curiosity I have is why is the behavior inconsistent when >> dealing with a remote directory? >> >> Don >> >> >> "RichS" <RichS@discussions.microsoft.com> wrote in message >> news:36B45FB8-F789-4350-809D-2242FC4CCFA6@microsoft.com... >> > It seems to work with -include on both local and remote machines if >> > the >> > path >> > specification ends mydir\* >> > >> > This is sort of hinted at in the documentation where is says >> > >> > The Include parameter is effective only when the command includes the >> > Recurse parameter or the path leads to the contents of a directory, >> > such >> > as >> > C:\Windows\*, where the wildcard character specifies the contents of >> > the >> > C:\Windows directory. >> > >> > >> > -- >> > Richard Siddaway >> > >> > Please note that all scripts are supplied "as is" and with no warranty >> > >> > >> > "Don Dally" wrote: >> > >> >> I have two directories that are identical including file timestamps. >> >> One >> >> directory is on a remote computer and the other directory is on my >> >> local >> >> pc. >> >> When I get the directory listing and use the -Include filter, I get >> >> different >> >> results: >> >> >> >> Local machine: >> >> ------------------ >> >> Command: Get-ChildItem c:\mydir\ -Include *.wav >> >> Result: No files returned >> >> >> >> Remote machine: >> >> -------------------- >> >> Command: Get-ChildItem \\remotemachine\mydir -Include *.wav >> >> Result: Returns all the files that match the *.wav mask >> >> >> >> Other than the path to the directory, these commands are identical. >> >> What >> >> I >> >> don't understand is why the behavior is different from the remote >> >> machine >> >> to >> >> the local machine. >> >> >> >> To make matters more confusing, the following command works as >> >> expected >> >> on >> >> the local machine: >> >> >> >> Get-ChildItem *.wav >> >> >> >> What is it that I don't understand about the -Include switch? >> >> >> >> Thanks, >> >> >> >> Don >> >> >> >> >> |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: Weird behavior using -Include switch on Get-ChildItem on local They are very similar in effect - filter works when retrieving objects rather than PowerShell applying a filter after retreiveal and before display -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Don Dally" wrote: > I am running the RTM version. Is using filter functionally the same > as -Include? If not, do you know the differences? > > "RichS" <RichS@discussions.microsoft.com> wrote in message > news 3B7C47C-B0BE-4CFC-B954-855D3BEE4A29@microsoft.com...> > I'm not able to duplicate the remote machine returning information without > > the wildcard on the end of the path are you using RTM PowerShell? If I > > use > > filter instead of include it doesn't matter whether the widcard is present > > or > > not > > -- > > Richard Siddaway > > > > Please note that all scripts are supplied "as is" and with no warranty > > > > > > "Don Dally" wrote: > > > >> Rich, > >> > >> Thanks. I missed that in the documentation. The addition of the wildcard > >> on > >> the parent object gave me the results I expected. > >> > >> Now the only curiosity I have is why is the behavior inconsistent when > >> dealing with a remote directory? > >> > >> Don > >> > >> > >> "RichS" <RichS@discussions.microsoft.com> wrote in message > >> news:36B45FB8-F789-4350-809D-2242FC4CCFA6@microsoft.com... > >> > It seems to work with -include on both local and remote machines if > >> > the > >> > path > >> > specification ends mydir\* > >> > > >> > This is sort of hinted at in the documentation where is says > >> > > >> > The Include parameter is effective only when the command includes the > >> > Recurse parameter or the path leads to the contents of a directory, > >> > such > >> > as > >> > C:\Windows\*, where the wildcard character specifies the contents of > >> > the > >> > C:\Windows directory. > >> > > >> > > >> > -- > >> > Richard Siddaway > >> > > >> > Please note that all scripts are supplied "as is" and with no warranty > >> > > >> > > >> > "Don Dally" wrote: > >> > > >> >> I have two directories that are identical including file timestamps. > >> >> One > >> >> directory is on a remote computer and the other directory is on my > >> >> local > >> >> pc. > >> >> When I get the directory listing and use the -Include filter, I get > >> >> different > >> >> results: > >> >> > >> >> Local machine: > >> >> ------------------ > >> >> Command: Get-ChildItem c:\mydir\ -Include *.wav > >> >> Result: No files returned > >> >> > >> >> Remote machine: > >> >> -------------------- > >> >> Command: Get-ChildItem \\remotemachine\mydir -Include *.wav > >> >> Result: Returns all the files that match the *.wav mask > >> >> > >> >> Other than the path to the directory, these commands are identical. > >> >> What > >> >> I > >> >> don't understand is why the behavior is different from the remote > >> >> machine > >> >> to > >> >> the local machine. > >> >> > >> >> To make matters more confusing, the following command works as > >> >> expected > >> >> on > >> >> the local machine: > >> >> > >> >> Get-ChildItem *.wav > >> >> > >> >> What is it that I don't understand about the -Include switch? > >> >> > >> >> Thanks, > >> >> > >> >> Don > >> >> > >> > >> > >> > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| get-childitem -include question | Bill Stewart | PowerShell | 4 | 07-10-2008 03:42 PM |
| understanding get-childitem -include | Leo Tohill | PowerShell | 2 | 05-19-2008 01:46 PM |
| Get-ChildItem -include leaks memory | Staffan Gustafsson | PowerShell | 9 | 06-05-2007 03:27 PM |
| Get-ChildItem -Recurse -Include pattern question... | Peter Birkholm-Buch | PowerShell | 1 | 02-26-2007 08:07 AM |
| About get-childitem -include parameter | applepwc | PowerShell | 6 | 05-25-2006 11:58 AM |