$docs = @(‘*.ini’, ‘*.cfg’, …)
foreach( $doc in $docs )
{
gci c:\ -file -recurse -filter $doc | move-item -dest e:\docs
}
From: [email protected] [mailto:[email protected]] On
Behalf Of David McSpadden
Sent: Tuesday, August 4, 2015 9:40 AM
To: [email protected]
Subject: RE: [NTSysADM] RE: Script (VB) or powershell
How would I make a list say for each dest folder?
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Rene de Haas
Sent: Tuesday, August 04, 2015 9:34 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [NTSysADM] RE: Script (VB) or powershell
Too quick in my reply. Now see you move them to different folders. Then you
can't do it that way.
On Tue, Aug 4, 2015 at 2:59 PM, Rene de Haas
<[email protected]<mailto:[email protected]>> wrote:
I would put the extensies in a file ten you can do it in one line. Easier to
add to or maintain as well.
Op 4 aug. 2015 14:43 schreef "David McSpadden"
<[email protected]<mailto:[email protected]>>:
So I ended up with this: (I am thinking this should get it all, things I have
saved to this machine over the years?)
gci c:\ -file -recurse -filter *.sql | move-item -dest e:\sql
gci c:\ -file -recurse -filter *.ini | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.cfg | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.log | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.htm* | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.doc* | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.pdf | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.txt | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.rtf | move-item -dest e:\docs
gci c:\ -file -recurse -filter *.iso | move-item -dest e:\isos
gci c:\ -file -recurse -filter *.wim | move-item -dest e:\isos
gci c:\ -file -recurse -filter *.db* | move-item -dest e:\dbs
gci c:\ -file -recurse -filter *.mdb | move-item -dest e:\dbs
gci c:\ -file -recurse -filter *.bat | move-item -dest e:\cmds
gci c:\ -file -recurse -filter *.cmd | move-item -dest e:\cmds
gci c:\ -file -recurse -filter *.xls* | move-item -dest e:\xlss
gci c:\ -file -recurse -filter *.gif | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.bmp | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.jpg | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.png | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.jpeg | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.mov | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.avi | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.wmv | move-item -dest e:\pics
gci c:\ -file -recurse -filter *.wav | move-item -dest e:\music
gci c:\ -file -recurse -filter *.mp* | move-item -dest e:\music
gci c:\ -file -recurse -filter *.mid | move-item -dest e:\music
gci c:\ -file -recurse -filter *.zip | move-item -dest e:\zips
gci c:\ -file -recurse -filter *.7z | move-item -dest e:\zips
-----Original Message-----
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Kurt Buff
Sent: Tuesday, August 04, 2015 12:13 AM
To: ntsysadm
Subject: Re: [NTSysADM] RE: Script (VB) or powershell
If either one gets the equivalent of rsync/unison, I'll make that the default.
I'm keeping my robocopy jobs for large sets of data between our US office and
our overseas offices, but I'm converting most everything else to PS.
Some day I might even rise to the level of apprentice programmer...
Kurt
On Mon, Aug 3, 2015 at 8:54 PM, Michael B. Smith
<[email protected]<mailto:[email protected]>> wrote:
> Robocopy is far more efficient than PS.
>
> But PS is a more generic solution.
>
> Neither are going anywhere. Choose the best solution for your environment.
>
> -----Original Message-----
> From: [email protected]<mailto:[email protected]>
> [mailto:[email protected]<mailto:[email protected]>]
> On Behalf Of Kurt Buff
> Sent: Monday, August 3, 2015 9:54 PM
> To: ntsysadm
> Subject: Re: [NTSysADM] RE: Script (VB) or powershell
>
> Given the current trajectory of Windows administration, I'd have to plunk for
> the PowerShell.
>
> Yes, for those of us (and I include me), who are used to doing things the
> other way, it's easier with robocopy, etc.
>
> But I think it's time to catch up.
>
> Kurt
>
> On Mon, Aug 3, 2015 at 5:59 PM, Micheal Espinola Jr
> <[email protected]<mailto:[email protected]>> wrote:
>> Nope. Now tell me which was more efficient, and which is easier to
>> maintain/modify by a wider net of personnel.
>>
>> --
>> Espi
>>
>>
>> On Mon, Aug 3, 2015 at 1:19 PM, Kurt Buff
>> <[email protected]<mailto:[email protected]>> wrote:
>>>
>>> gci c:\mystuff -file -recurse -filter *.sql | move-item n:\sql gci
>>> c:\mystuff -file -recurse -filter *.bat | move-item n:\sql
>>>
>>> That wasn't so hard, was it?
>>>
>>> Kurt
>>>
>>> On Mon, Aug 3, 2015 at 12:57 PM, Micheal Espinola Jr
>>> <[email protected]<mailto:[email protected]>> wrote:
>>>>
>>>> There are a lot of things that vb and ps overcomplicate.
>>>>
>>>> --
>>>> Espi
>>>>
>>>>
>>>> On Mon, Aug 3, 2015 at 12:15 PM, David McSpadden
>>>> <[email protected]<mailto:[email protected]>> wrote:
>>>>>
>>>>> Seriously that simple?
>>>>>
>>>>> I am annoyed.
>>>>>
>>>>> And thank you.
>>>>>
>>>>>
>>>>>
>>>>> From:
>>>>> [email protected]<mailto:[email protected]>
>>>>> [mailto:[email protected]<mailto:[email protected]>]
>>>>> On Behalf Of Joe Spinks
>>>>> Sent: Monday, August 03, 2015 3:13 PM
>>>>>
>>>>>
>>>>> To: '[email protected]<mailto:[email protected]>'
>>>>> Subject: [NTSysADM] RE: Script (VB) or powershell
>>>>>
>>>>>
>>>>>
>>>>> robocopy c:\*.sql n:\sql /s /e /w:0 /r:0 /log:sqlcopy.txt /nfl
>>>>> /ndl
>>>>>
>>>>> robocopy c:\*.bat n:\sql /s /e /w:0 /r:0 /log:batcopy.txt /nfl
>>>>> /ndl
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> From:
>>>>> [email protected]<mailto:[email protected]>
>>>>> [mailto:[email protected]<mailto:[email protected]>]
>>>>> On Behalf Of David
>>>>> McSpadden
>>>>> Sent: Monday, August 03, 2015 2:08 PM
>>>>> To: '[email protected]<mailto:[email protected]>'
>>>>> Subject: [NTSysADM] RE: Script (VB) or powershell
>>>>>
>>>>>
>>>>>
>>>>> ?
>>>>>
>>>>>
>>>>>
>>>>> From:
>>>>> [email protected]<mailto:[email protected]>
>>>>> [mailto:[email protected]<mailto:[email protected]>]
>>>>> On Behalf Of Damien
>>>>> Solodow
>>>>> Sent: Monday, August 03, 2015 3:05 PM
>>>>> To: [email protected]<mailto:[email protected]>
>>>>> Subject: [NTSysADM] RE: Script (VB) or powershell
>>>>>
>>>>>
>>>>>
>>>>> Could just do that with robocopy.
>>>>>
>>>>>
>>>>>
>>>>> DAMIEN SOLODOW
>>>>>
>>>>> Senior Systems Engineer
>>>>>
>>>>> 317.447.6033<tel:317.447.6033> (office)
>>>>>
>>>>> 317.447.6014<tel:317.447.6014> (fax)
>>>>>
>>>>> HARRISON COLLEGE
>>>>>
>>>>>
>>>>>
>>>>> From:
>>>>> [email protected]<mailto:[email protected]>
>>>>> [mailto:[email protected]<mailto:[email protected]>]
>>>>> On Behalf Of David
>>>>> McSpadden
>>>>> Sent: Monday, August 3, 2015 3:01 PM
>>>>> To: ntsysadm
>>>>> <[email protected]<mailto:[email protected]>>
>>>>> Subject: [NTSysADM] Script (VB) or powershell
>>>>>
>>>>>
>>>>>
>>>>> Anyone have a good script to go through all directories on a
>>>>> volume and move to a network or flash drive?
>>>>>
>>>>> Specifically I want a script that can grab all .sql or .bat’s from
>>>>> my machine and move them to a network folder called N:\SQL\ ???
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> David McSpadden
>>>>>
>>>>> Systems Administrator
>>>>>
>>>>> Indiana Members Credit Union
>>>>>
>>>>> P: 317.554.8190<tel:317.554.8190> | F: 317.554.8106<tel:317.554.8106>
>
>
This e-mail and any files transmitted with it are property of Indiana Members
Credit Union, are confidential, and are intended solely for the use of the
individual or entity to whom this e-mail is addressed. If you are not one of
the named recipient(s) or otherwise have reason to believe that you have
received this message in error, please notify the sender and delete this
message immediately from your computer. Any other use, retention,
dissemination, forwarding, printing, or copying of this email is strictly
prohibited.
Please consider the environment before printing this email.
This e-mail and any files transmitted with it are property of Indiana Members
Credit Union, are confidential, and are intended solely for the use of the
individual or entity to whom this e-mail is addressed. If you are not one of
the named recipient(s) or otherwise have reason to believe that you have
received this message in error, please notify the sender and delete this
message immediately from your computer. Any other use, retention,
dissemination, forwarding, printing, or copying of this email is strictly
prohibited.
Please consider the environment before printing this email.