Attempting to locate number of files of a particular extension on a SP 2010 farm

Was doing some web searching to find the means to get a count of the number of files of a particular extension. My code is:
Get-SPSite -Limit All | Get-SPWeb -Limit All | Select -ExpandProperty Lists | Where { $_.GetType().Name -eq "SPDocumentLibrary" –and -not $_.Hidden } | Select -ExpandProperty Items | Where { $_.Name -Like "*.exe" } | Select Name, @{Name="URL";
Expression={$_.ParentList.ParentWeb.Url + "/" + $_.Url}} > d:\temp\exefound.txt
(all on one line)
I am running the sharepoint management console "as administrator".
The above script runs to completion without error - or results.
However, I know for certain that there are files of the "file.abc" extension.
Therefore, there is something I am missing here.
What improvements to the script can I make so that I get real results?
Thank you for your suggestions!

Well, this has been interesting. I did get the list of URLs that I needed from this script.
Then, of course, those to whom I was reporting had a more complex request - how many files are on the system with _any_ of the blocked file extensions.
So I did some research to see how I might modify the script. I turned your script above into this:
$SPwebApp = Get-SPWebApplication http://mysite
function EndsWithAny( [string]$s, [string[]]$items ) {
  $matchingItems = @($items | where { $s.EndsWith( $_ ) })
  [bool]$matchingItems
$BlockedExtensions = @(".adp",".app",".asa",".ashx",".asmx",".asp",
".bas",".bat",
".cdx","cer",".chm",".class",".cmd",".cnt",".com",".config",".cpl",".crt",".csh",
".der",".dll",
".exe",
".fxp",
".gadget",".grp",
".hlp",".hpj",".hta",".htr",".htw",
".ida",".idc",".idq",".ins",".isp",".its",
".jse",".json",
".ksh",
".lnk",
".mad",".maf",".mag",".mam",".maq",".mar",".mas",".mat",".mau",".mav",".maw",".mcf",
".mda",".mdb",".mde",".mdt",".mdw",".mdz",".msc",".msh",".msh1",".msh1xml",".msh2",".msh2xml",".mshxml",".msi",".msp",".mst",
".ops",
".pcd",".pif",".pl",".prf",".prg",".printer",".ps1",".ps1xml",".ps2",".ps2xml",".psc1",".psc2",".pst",
".reg",".rem",
".scf",".scr",".sct",".shb",".shs",".shtm",".shtml",".soap",".stm",".svc",
".url",
".vb",".vbe",".vbs",".vsix",
".ws",".wsc",".wsf",".wsh"
foreach ($SPsite in $SPwebApp.Sites)
    foreach ($web in $SPsite.AllWebs)
      $listCounter = $web.Lists.Count
      foreach ($list in $web.Lists)
        if($list.BaseType -eq "DocumentLibrary")
             foreach($item in $list.Items)
                if(EndsWithAny($item.Name, $BlockedExtensions) )
                    $web.Url + "/" + $item.Url  >>  d:\temp\exefound4.txt
When I ran the above - which isn't much different than yours - I get 0 results instead of the nearly 200 lines before. So it looks, to me, like there is some issue with this line of the above function:
  $matchingItems = @($items | where { $s.EndsWith( $_ ) })
When I try things from the command line, I see:
PS C:\Users\sa_spfarm> $s = "any.f"
PS C:\Users\sa_spfarm> $items = @( ".abc", ".f", "exe" )
PS C:\Users\sa_spfarm> $items | where { $s.EndsWith($_) }
.f
PS C:\Users\sa_spfarm>
So then I added some echos to the function:
function EndsWithAny( [string]$s, [string[]]$items ) {
  echo "items = $items"
  echo "s = $s"
  $matchingItems = @($items | where { $s.EndsWith( $_ ) })
  echo "matchingItems = $matchingItems"
  [bool]$matchingItems
Then I try to use the function:
PS C:\Users\sa_spfarm> $items
.abc
.f
exe
PS C:\Users\sa_spfarm> EndsWithAny( "abc.f", $items )
items =
s = abc.f System.Object[]
matchingItems =
False
PS C:\Users\sa_spfarm>
So, why is items empty inside the function? Notice that the function's arguments are $s and $items internal to the function; globally the $items is passed in and I would have expected it to be assigned to the internal variable.

Similar Messages

  • Where do you select which program you want to open files with a particular extension?

    Where do you go to select which program should open files with particular extensions?

    if you right click on the file and select get info, a window will open. Click on the "open with" and the window will expand. There you can select which application you want that document to open with. If you want to open ALL documents of that type with a specific application click the change all button.

  • [Win VC++ 6.0 ]How to get the number of files count in a folder using VC++ 6.0?

    Hi all,
    Can any one tell how to get the number of files(.EPS) count inside a folder when the folder path is specified in VC++ 6.0?
    Thanks in Advance.
    Regards
    myriaz

    I'm a little confused by the question, but it sounds like you're asking how to count the number of files with a particular extension in a given directory? That's not really an AI SDK question, but it's a fairly easy one to find if you google it. If you're trying to use Illustrator to do it, AI doesn't have a general purpose file API. It has a few functions to do some things that Illustrator needs, but I don't think enumerating directories is one of them.

  • Pick a file based upon its extension

    Hi Experts,
    I have a requirment. I have to pick a file based upon its extension, i.e., the file having a particular extension, should be picked up before fiiles having a diferent extension.
    Is this possible using only the adapter configuration?
    Thanks and Regards,
    Sanjeev.

    Hi Sanjeev ,
    Have a look at following PDF .These will be helpful to create your Road map
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4f61fddf-0601-0010-7ab5-fb749538f6ab
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d458a870-0601-0010-caab-b99c79741964
    /people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm
    BPM Steps..
    http://help.sap.com/saphelp_nw04/helpdata/en/62/dcef46dae42142911c8f14ca7a7c39/frameset.htm
    /people/shabarish.vijayakumar/blog/2006/11/26/adapter-scheduling--hail-sp-19-
    Reward points if it is useful
    Thanks
    Sunil Singh

  • Diappearing photos replaced by an exclamation point within a triangle.  Prior to loading Lion I could put the image number in finder and locate the original file for that photo.  How do I restore photos now?

    I had problems with photos disappearing and being replaced by an exclamation point within a triangle.  I can see the photo in the thumbnail summary but when you click on it, the screen goes black and the exclamation point within a triangle appears along with the info on the original image number (i.e., img_1120.jpg). Prior to loading Lion, I could go to Finder, enter the image number and locate the original file for that photo.  I could then restore it for editing, copying into Print Shop directly, etc.   That no longer works after installing Lion.   How do I restore photos now?  I have 100s of photos that I have been going back to the original files and restoring and I am frantic that I will no longer be able to get to the original files.  Please help!  Thanks

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    What version of iPhoto? Assuming 09 or later:
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • I just upgraded my mac book to 10.6.8 and downloaded the new version of itunes. When I try to open it and error message appears saying, "The iTunes Library file cannot be found or created. The default location for this file is in the "iTunes" folder.

    I just upgraded my mac book to 10.6.8 and downloaded the new version of itunes. When I try to open it and error message appears saying, "The iTunes Library file cannot be found or created. The default location for this file is in the "iTunes" folder in the "Music" folder."
    I have tried a few things but iTunes closes right after i click okay. Anyone know anything?

    Look in your Home > Music folder.  There should be an iTunes folder there and it should have a number of files and folders including one called library.itl  You want to guide iTunes to that file.  If you don't see that file or folder then in your next post you will have to be very specific as to what you do see or how you have your iTunes set up because that's where it should be according to default settings.

  • I'm using acrobat pro in my project after debuging the project and after opening a certain number of PDF files I receive the message: the maximum number of files opened has been reached, you have to close some files to continu.even doing that, I steel rec

    I'm using acrobat pro in my project after debuging the project and after opening a certain number of PDF files I receive the message: the maximum number of files opened has been reached, you have to close some files to continu.even doing that, I steel receive the same message.Some one can tel what to do please? Thanks

    Hi Memalyn
    Essentially, the bare issue is that you have a 500GB hard drive with only 10GB free. That is not sufficient to run the system properly. The two options you have are to move/remove files to another location, or to install a larger hard drive (eg 2TB). Drive space has nothing to do with SMC firmware, and usually large media files are to blame.
    My first recommendation is this: download and run the free OmniDiskSweeper. This will identify the exact size of all your folders - you can drill down into the subfolders and figure out where your largest culprits are. For example, you might find that your Pictures folder contains both an iPhoto Library and copies that you've brought in from a camera but are outside the iPhoto Library structure. Or perhaps you have a lot of purchased video content in iTunes.
    If you find files that you KNOW you do not need, you can delete them. Don't delete them just because you have a backup, since if the backup fails, you will lose all your copies.
    Don't worry about "cleaners" for now - they don't save much space and can actually cause problems. Deal with the large file situation first and see how you get on.
    Let us know what you find out, and if you manage to get your space back.
    Matt

  • While updating the older version iTunes to latest one it shows "a network error occurred while attempting to read from the file: C:\windows\installer\iTunes64.msi. pls help on this matter to connect my i5 to PC. Thanks in advance

    while updating the older version iTunes to latest one it shows "a network error occurred while attempting to read from the file: C:\windows\installer\iTunes64.msi. pls help on this matter to connect my i5 to PC. Thanks in advance

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page): 
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Trying to update to iTunes 10.4.1 and I get a message "A network error occured while attempting to read from the file C:|Windows|Installer|iTunes.msi"  Running WIndows 7 with all updates done.  I  have never had an issue with iTunes updating before.  Anyo

    iTunes has tried to update itself and runs into an error and tells me to manually install.  When I d/l and run the iTunesSetup.exe file I always encounter the following error message...
    "A network error occured while attempting to read from the file C;|Windows|Installer|iTunes.msi" and iTunes does not update to iTunes 10.4.1.
    Anyone know what is creating this error message?  Thanks for the help...

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page): 
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Cannot Locate the Original File ? ?- Help Please

    Hi ,
    I have Consolidated my Library to New folder on my External Hard-Drive. so i Know that all my music is in One palce..
    I have a Problem, If i try and play a Track, It Now get a message saying Cannot Locate the Original File..& has this ! against the track..???
    What has gone wrong ?
    Many thanks

    Unfortunately I'm in the same boat. Somehow I cannot locate over 30 GB of music that just disappeared?!
    Moved the iTunes folder from my Music folder from the HD to my 250 GB external drive. I did not rename it. Kept it the same name. Went into the Advanced folder in iTunes Preferences and chose to use the external drive as my source for music. However, I noted that an iTunes folder always reappeared in my Music folder on the HD. Didn't realize that I had to Consolidate libraries until later on, but did so the next day as I attempted to figured out why it wasn't working ("cannot locate original file"). When I open iTunes, all of my songs and playlists are listed (I assume this is cache), but none will play except for a few random artists (most have "!"). When I go back and look at the actual iTunes Music folder, it has only these random artists listed (I assume these are the (only?) original files?).
    Not sure where everything else went when I haven't deleted any iTunes files? I've read quite a few threads with this same problem without any real answers. When I use Spotlight to locate the original songs, I get zero found.
    Is there any easy answer as to where my songs went or am I looking at taking this Mac in for some file retrieval.
    Many thanks to anyone that can help.

  • Help! Muse 2014.3 keeps crashing when I attempt to save my .muse file

    I have the latest version of Muse [2014.3] Since the update the application repeatedly crashes at the least 'provocation'.
    I'm building a multipage website for a client and brought the last file home [I'd been working on it at my office]. One or two of the image files needed updating, which I did. When I attempted to save the updated file I got [and keep getting] a fatal error.
    The error message reads: "Dangling Ref or Ownership: BoxPageItem refers to unknown UID, BoxPageItem refers to unknown UID, BoxPageItem refers to unknown UID".
    The application then hangs and I have to force quit. This is happening repeatedly and the dialogue tells me nothing about how to fix these errors [3 image errors perhaps, since the current crashes happen after updating images?]. I'm in a serious time crunch now, how can I recover my file to continue working on this project and what is causing the problem? Anyone help me?
    Is this version of Muse really that unstable?
    Thanks,
    Charlie

    Hi Fabia,
    I think I fixed it over the weekend. But interestingly, my problem was images inside compositions too.
    I did something similar to you, where I didn't let Muse update when the file opens [which was causing the crashes]. Instead I located the images in the assets panel, opened them in Photoshop and resaved them. Then I imported and saved after each one. This seemed to work.
    For me, the 'container' was apparently OK, I had the background fill set to none anyhow, so reasoned there might be a problem with one of the seven images [seven in my case, but which one, or maybe all?]. Since then, I've been able to add content and save normally, and this morning I've been able to let the client see the site progress, as promised.
    Thanks for the reply and good luck with your project.
    Charlie

  • [JS CS3] About Number of files in folder.

    Hello,
    Is there any way to get number of files in a folder using javascript?.
    I am going to locate the folder and then i want to create a script that will give number of files in that folder.
    Thank you,
    --Avi

    > Is there any way to get number of files in a folder using javascript?.
    There are a couple of different ways. Here's the most concise I can think of:
    folder.getFiles(function(f) { return f instanceof File; }).length
    But you really do need to read the docs if you are going to be working with File
    and Folder objects.
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • Pre-configure save location for converting files to PDF from shell context menu

    Hi all,
    I like Acrobat's integration into the Windows Explorer through the shell context menu command "Convert to PDF", which allows me to drag select a number of files (word documents et cetera) to batch convert them into PDF. It beats doing batch processing fr the Acrobat interface.
    However, it asks me for the save location of each file individually. I would like to have them saved in the same directory as the original file, as the default option so I won't have to attend to the conversion. I can't find such an option in Acrobat's preferences menu though
    Any gurus or users here know of a way around that?
    Regards,
    Jay

    Does your user have custom add-ons besides the Acrobat PDFMaker add-on?  If so, try disabling the other add-ons as a test to see if you get the same results.
    Does your user have a custom template?  Try moving it out and using the standard MS Word template as test?
    Did your user have a previous installation of Adobe Acrobat??  If so, check the Add-ons to see if an older version is still registered with MS Word.

  • Save as/Save does not point to file open location for the file

    Hi,
    Working with large number of files it's imperative that I can rely on the software's ability to know where open files are located on disk, so that when needed I can save all open files to their original locations. Unfortunately CS6 wil save all open files to the location of the last saved file!
    Even after a power out, or CS6 crash, all the recovered files will point to the directory last document was saved to!!
    This means that if I have 10 open files from 10 different folders, they will all be saved to one folder, in which maximum one of the 10 files have been opened from and I will not know where they are if I follow their original file location (e.g from Lightroom import from camera).
    This generates a very time consuming manual workaround, in which I must file-by-file open the correct folder in Save as dialogue.
    Using "Save As to Original Foder" has no meaning selected or de-selected.
    I don't know of any other software that suppresses original file location in save/save as...
    How do I disable this unproductive and illogical malfunction?
    Morten

    Okay, doing what you outlined, I'm getting the same result.  It's acting like the file you open is a new file that hasn't been saved, and that always defaults to the last saved location.  I'm not saying it should be like this, but I think it is default behavior.  Only advice I can offer is to put in a feature request:
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    The squeeky wheel gets the oil, so let them know.

  • Limiting the number of files being picked up by the sender file adapter

    We are running a file adapter to collect xml files from a legacy system in a shared network location.  The files are picked up, information is sorted and mapped, and then sent to a proxy on our CRM system to store the data.  Very simple and not-complex.
    Our initial data load will consist of somewhere in the neighborhood of 900k records, which is killing CRM.
    A co-worker with a bit more experience was telling me that he believes there is a way to limit the number of files that will be pulled per iteration of the file communication channel.  If this is the case, can someone share with me the parameters that need to be set?
    My apologies if this is a duplicate post - I have tried to look for a good answer in the forums and have come up empty.
    We are running PI 7.1, and I believe it is SP 6. 
    Thanks in advance for the help,
    Ben

    Hi Ben,
    There is no standard way to limit the number of files to be processed by the communication channel.
    On the Sender File CC, there is a parameter " Maximum File Size" which restricts the files bigger than the specific size, but this is just a prevention not a solution.
    If you have a single big size file, then somehow you have to create small sized files out of it.
    Thanks,
    Pooja Pandey

Maybe you are looking for

  • How do you get your old back ups back

    how do you get your old back ups back

  • Oracle BI Publisher 11g Enterprise

    Kelly, I believe you said in another thread "Your PLM4P license includes a free limited use license for BI Publisher". So, we can download Oracle BI Publisher 11g Enterprise and hook it up to PLM4P for free? And what is meant when you say 'limited us

  • Sharepoint 2013 Custom Workflow - Email link to EditForm.aspx for Workflow Task

    I have created a custom workflow which starts a task with one or two users once a form is submitted.  These users receive an email with a link to the task that has been created.  The problem is it doesn't open the edit form for the task it just links

  • Anyone have any luck with the tascam 144?

    i am buying a tascam 144 usb interface in about a week cus someone told me it worked well with garage band but now i am having second thoughts cus i have read that a lot of people have trouble getting garage band to recognize it. anyone got any advic

  • Why does safari stop opening web pages after a while in use?

    Since upgrading to Lion, my imac (Intel) 21.5 works fine for most of the time, but frequently when using Safari to browse the internet, it will stop accessing pages, either from new searches or from history - the blue loading bar in the address panel