Can you use an IF to do that “IF %extension%=sql then move to e:\sql” ?
Gavin Wilby IT Support Engineer From: [email protected] [mailto:[email protected]] On Behalf Of Rene de Haas Sent: 04 August 2015 14:34 To: [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. SMP Partners Limited, SMP Trustees Limited and SMP Fund Services Limited are licensed by the Isle of Man Financial Supervision Commission. SMP Accounting & Tax Limited is a member of the ICAEW Practice Assurance Scheme. SMP Partners Limited registered in the Isle of Man, Company Registration No: 000908V Directors: M.W. Denton, M.J. Derbyshire, S.E McGowan, O. Peck, J.J. Scott, S.J. Turner SMP Trustees Limited registered in the Isle of Man, Company Registration No: 068396C Directors: A.C. Baggesen, M.W. Denton, O. Peck, J.J. Scott, J. Watterson, J. Cubbon SMP Fund Services Limited registered in the Isle of Man, Company Registration No: 120288C Directors: V. Campbell, M.W. Denton, D.A. Manser, S.E McGowan, J.J. Scott, R.K. Corkill SMP Accounting & Tax Limited registered in the Isle of Man, Company Registration No: 001316V Directors: I.F. Begley, A.J. Dowling, P. Duchars, J.J. Scott, S.J. Turner SMP Capital Markets Limited registered in the Isle of Man, Company Registration No: 002438V Directors: M.W. Denton, M.J. Derbyshire, D.F Hudson, S.E McGowan, O. Peck, J.J. Scott. SMP Partners Limited, SMP Trustees Limited, SMP Fund Services Limited, SMP Accounting & Tax Limited and SMP Capital Markets Limited are members of the SMP Partners Group of Companies. This email is confidential and is subject to disclaimers. Details can be found at: http://www.smppartners.com/disclaimer.asp ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________
