I have a large list of folder names, and I am trying to find a script that will search a directory for each of these folder names and move them to another location if found. Since I am not a programmer, and assistance would be greatly appreciated.<\/p>\n
Chris<\/p>","upvoteCount":8,"answerCount":7,"datePublished":"2016-12-07T20:13:04.000Z","author":{"@type":"Person","name":"chrispatterson1433","url":"https://community.spiceworks.com/u/chrispatterson1433"},"acceptedAnswer":{"@type":"Answer","text":"
Spoke to our development team and I’m going to get assistance from them to create a script. certainly appreciate everyone’s input and help.<\/p>","upvoteCount":0,"datePublished":"2016-12-14T18:07:17.000Z","url":"https://community.spiceworks.com/t/script-help/545475/7","author":{"@type":"Person","name":"chrispatterson1433","url":"https://community.spiceworks.com/u/chrispatterson1433"}},"suggestedAnswer":[{"@type":"Answer","text":"
I have a large list of folder names, and I am trying to find a script that will search a directory for each of these folder names and move them to another location if found. Since I am not a programmer, and assistance would be greatly appreciated.<\/p>\n
Chris<\/p>","upvoteCount":8,"datePublished":"2016-12-07T20:13:04.000Z","url":"https://community.spiceworks.com/t/script-help/545475/1","author":{"@type":"Person","name":"chrispatterson1433","url":"https://community.spiceworks.com/u/chrispatterson1433"}},{"@type":"Answer","text":"
Have you looked into it or done some research? What have you tried so far?<\/p>\n
Do you have any snippets? If so please post them. If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n
Some things you want to look into:<\/p>\n
Get-Childitem\nForeach-Object\nwhere-object\n\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2016-12-07T20:15:40.000Z","url":"https://community.spiceworks.com/t/script-help/545475/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"fox example looking for pst and moving<\/p>\n
$sourceDir = 'C:\\MyShadow'\n$targDir = '\\\\server\\EmailBackup\\'\n\nGet-ChildItem $sourceDir -filter \"*.pst\" -recurse | \n foreach{ \n \n move-Item $_.FullName -destination $sourceDir \n } \n<\/code><\/pre>","upvoteCount":1,"datePublished":"2016-12-07T20:25:50.000Z","url":"https://community.spiceworks.com/t/script-help/545475/3","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}},{"@type":"Answer","text":"I located a Powershell script that prompts for the directory to look in, and the folder name to search for. When testing searching a single document, I noticed the memory usage on the server continued to creep up, so I cancelled after a few minutes of running with no results:<\/p>\n
<#
\n\" Satnaam WaheGuru Ji\"<\/p>\n
Author : Aman Dhally
\nE-Mail : [email protected]<\/a>
\nwebsite : www.amandhally.net<\/a>
\ntwitter : https://twitter.com/#!/AmanDhally<\/a>
\nfacebook: PowerShell User Group, New Delhi (India) | Facebook<\/a>
\nLinkedin: http://www.linkedin.com/profile/view?id=23651495<\/a><\/p>\nDate : 13-Sept-2012, 11:43 AM
\nFile : Find_Folder
\nPurpose : FInd Folders Using Powershell<\/p>\n
Version : 1<\/p>\n
#>
\n“n\" write-Host \"---------------------------------------------\" -ForegroundColor Yellow $filePath = Read-Host \"Please Enter Folder Path to Search\" write-Host \"---------------------------------------------\" -ForegroundColor Green $fileName = Read-Host \"Please Enter Folder Name to Search\" write-Host \"---------------------------------------------\" -ForegroundColor Yellow \"<\/code>n”<\/p>\nGet-ChildItem -Recurse -Force $filePath -ErrorAction SilentlyContinue | Where-Object { ($.PSIsContainer -eq $true) -and ( $<\/em>.Name -like “$fileName<\/em>”) } | Select-Object Name,FullName | format-Table * -AutoSize<\/p>\nwrite-Host “------------END of Result--------------------” -ForegroundColor Magenta<\/p>\n
<\/a>end of the script<\/h1>","upvoteCount":0,"datePublished":"2016-12-08T15:50:25.000Z","url":"https://community.spiceworks.com/t/script-help/545475/4","author":{"@type":"Person","name":"chrispatterson1433","url":"https://community.spiceworks.com/u/chrispatterson1433"}},{"@type":"Answer","text":"delete this bit out of that script and you might start getting output:<\/p>\n
| format-Table * -AutoSize<\/p>\n
As it is, the script is buffering all the data that it finds because it has to format it nicely before dumping it to the screen.<\/p>","upvoteCount":0,"datePublished":"2016-12-08T16:29:08.000Z","url":"https://community.spiceworks.com/t/script-help/545475/5","author":{"@type":"Person","name":"psophos","url":"https://community.spiceworks.com/u/psophos"}},{"@type":"Answer","text":"
I eliminated<\/p>\n
| format-Table * -AutoSize<\/p>\n
from the script and tried running again. memory continued to climb without displaying any result.<\/p>\n
All answers are greatly appreciated. Unfortunately, I am not astute enough in scripting to create this from scratch.<\/p>\n
Chris<\/p>","upvoteCount":0,"datePublished":"2016-12-08T17:47:00.000Z","url":"https://community.spiceworks.com/t/script-help/545475/6","author":{"@type":"Person","name":"chrispatterson1433","url":"https://community.spiceworks.com/u/chrispatterson1433"}}]}}