Find file by file name containing a string?

Hi Guys,
I'm trying to write a function that looks for a txt file containing a string in it's name. 
$scriptLoc = [string](Get-Location)
$files = Get-ChildItem - Path $scriptLoc -filter *Yellow
So I have a list of files. 
Yellow_Config.txt
Blue_Config.txt
Red_Config.txt
What I want to do is only retrieve the .txt that contains the name Yellow. When I run my code nothing happens.

You've got your wildcard in the wrong place in your filter:
$files = Get-ChildItem - Path $scriptLoc -filter Yellow*
See:
Get-Help about_Wildcards
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • How do I find file names containing special character

    hi all
    I need your help with a code that deals with finding file names containing special characters like * / \ : ? " |
    the reason is I am doing a project that transfer files and folders from Mac to Windows. But names containing above characters cant be moved to windows.
    the part of the code I write is like this
    set illegal_syntax to paragraphs of (do shell script "find " & quoted form of POSIX path of oneFolder & " -name '*'")
    if (illegal_syntax is not equal to {""}) then
    repeat with each_record in illegal_syntax
    do shell script "/usr/bin/ditto -c -k -rsrc --keepParent " & quoted form of each_record & space & quoted form of (each_record & ".zip")
    end repeat
    end if
    First of all that '' will gives me an error.
    Second, what i tried to do is once the file/folder is found, zip it at current location. But the problem is how can I zip it without the special character? or should I just give it a name, like "originalfile.zip";?
    Last, or maybe you have better idea to deal with this situation? BTW, I can not rename or delete the file/folder because customer won't allow me to do it.

    The backslash is used to escape characters in AppleScript, so if you want to use it in a string you need to escape the escape character, for example "\\*".
    You could set the name of the archive by replacing the illegal character with another one, such as an underscore:
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; border: 1px solid #000000; width: 720px; color: #000000; background-color: #FFDDFF; overflow: auto">set each_record to "some*file*name" -- example
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "*"}
    set the ItemList to text items of each_record
    set AppleScript's text item delimiters to "_"
    set each_record to the ItemList as text
    set AppleScript's text item delimiters to TempTID
    log each_record --> some_file_name
    </pre>

  • It can't find URL when i use HLS for vod and the vod file name contain Chinese.

    It can't find URL when i use HLS for vod and the vod file name contain Chinese。eg: http://127.0.0.1:8134/hls-vod/你好.mp4.m3u8.
    How does it support Chinese path?

    To answer the post title FireFox save all downloads automatically in the download folder, which you can find in the Documents folder. If you want to choose where to save your downloads go to tools>options>check always ask me where to save files.
    Secondly, I am assuming you have IE 8 installed as this is the only version that supports this fix that is currently not in beta. Go to control panel>internet options>advanced tab and reset the settings at the bottom. This may or may not fix the problem but it is a good first step.

  • Saving a file in a with a file name containing Japanese Characters

    Hi,
    I hope some genius out there comes up with the solution to this problem
    Here it is :
    I am trying to save some files using a java program from the command console , and the file name contains japanese characters. The file names are available to me as string values from an InputStream. When I try to write to a File Object containing the japanese characters , I get something like ?????.txt . I found out that I am able to save the files using the unicode value of the java characters.
    So I realize that the trick is to convert the streaming japanese characters , character by character into their respective unicode value and then Create A File Object with that name. The problem is -> I cant find any standard method to convert these characters into their unicode values. Does anyone have a better solution ? Remember , its not writing japanese characters to a file , but creating a file with japanese characters in the file name !!!!
    Regards
    Chandu

    retrive a byte array out of the input Stream and store the values in String using the condtructor
    String(byte [] bytes, String enc)
    where encoding would be Shift_Jis for japanese I guess.
    Now to understand this concept basically all the Strings are unicode however when you are passing a byte array String has no means to know what is the encoding of the byte array, which is being used to instantiate the String value so if no encoding is specified it takes the System value which is mostly iso-8859-1. This leads to displaying ?
    However in case you know the encoding of the array specifying that in the constructor would be a real help.

  • Related Item link is broken in DispForm.aspx for a task in Workflow Tasks list if file name contains " ' " (single quote)

    Description:
    We have created a custom workflow in Microsoft Visual Studio 2013 and SharePoint 2013. This Workflow is associated with a Document library.
    This Workflow starts as soon as any new item is created OR updated in Document library and creates a Task in Workflow Tasks list.
     Related Item link is not working in following scenario -
    Upload a file that contains “ ' “
    in its name, in a document library
    Navigate to Workflow Tasks list
    Open View Item form (DispForm.aspx ) of  Task Created by workflow then click on link in Related Item fields
    OUPUT:
    Related Item link  truncates after “ ' “
    Eg.
    Original Link: http://<Site URL>/Documents/te'st.txt
    Related Item Field: http://<Site URL>/Documents/te
    Is this known bug in SharePoint 2013 OR any hotfix available to fix it.

    Hi,
    As I tested per your description, I can reproduce the issue as well.
    From what I have found out, it seems SharePoint resolve single quote into different code in different place. During the test, if I set Task Name to Document Name, single quote will be resolved to &#39; , if I set some field to Document encoded URL, single
    quote will be resolved to %27 . For now, I haven't found out any article talking about this issue.
    As workaround, we may find out a way to change the Related Item field. However, it is OOB field in workflow task (SharePoint 2013) content type, and this content type cannot be modified in form.
    I'd suggest you add new column to get document url and place in the form in Task content type settings.
    Regards,
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Finding file name

    Hi,
    I use this command "find . -name "*.html" | xargs cat | grep "searchCriteria" " to find string searchCriteria in any file having html as extension.
    I get the output searchCriteria if that string is in the file name.. But, what if I want to know the location of html file from which searchCriteria was displayed?
    Regards,

    The grep command does not need "cat":
    find . -iname "*.html" | xargs grep -i "Search Criteria"(match and search is also case insensitive)
    I get the output searchCriteria if that string is in the file name.. But, what if I want to know the location of html file from which searchCriteria was displayed?Not sure if I understand you here. Can you give an example?
    Edited by: Dude on Jul 1, 2011 1:18 AM

  • Install iTunes 10.4.1 install error - The Folder Path "File Name" contains an invalid character

    Upgraded computer from XP Prof 32-Bit to Windows 7 Ultimate 64-Bit (Upgrade package, performed Custom Install).
    Attempt to install iTunes 10.4.1 for 64-Bit.  Receiving the following error/problem:
    The Folder Path "File Name on my external drive" contains an invalid character
    I click ok and then get this:
    The Installer encountered errors before iTunes could be configured.  Errors occurred during installation.  Your system could not be modified,  Please run the installer again, or click Finish to exit.
    Any fixes for this?

    Sorry, one of us is not managing to be clear enough.
    Does the message read The Folder Path "File Name on my external drive" contains an invalid character or perhaps The Folder Path "<some path name here>" contains an invalid character?
    If so, then the problem might be just what it says it is with the path name in question... Either way if you list the path given in the error message in a reply to this thread it might provide a clue for anyone tying to help with the problem.
    You could try downloading the installer to C:\iTunesSetup.exe in case that helps.
    tt2

  • Finding File Name And Using It To Place The Graphic Using VBscript

    I'm trying to find a file name (example, <place:E:\logo.tif>) in each text frame if it's there, then remove the text from the frame and then place the file in the frame. This is to get around the feature missing from InDesign that is in PageMaker that allowed you to import inline graphics using tagged text. Below is what I have come up with so far. The file name is currently hard coded in the example below.
    Thanks,
    Archie
    For I = 1 to cInt(myMountNumber)
    Set myTextFrames = myDocument.TextFrames
    Set myCurrentFrame = myTextFrames.Item(I)
    If myCurrentFrame.Texts.ItemByRange (1,7).Contents = "<Place:" Then
    Set myLastCharacter = myCurrentFrame.Characters.Item(-2)
    myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents = ""
    myCurrentFrame.InsertionPoints.Item(1).Place ("E:\sxs\pm65\Sundco.jpg")
    myCurrentFrame.Fit idFitOptions.idProportionally
    End If
    Next

    ' For I = 1 to cInt(myMountNumber)<br />For I = 1 to myDoc.TextFrames.Counts<br />' I think your myMountNumber is equal to TextFramesCount<br /><br />' Set myTextFrames = myDocument.TextFrames<br />' Set myCurrentFrame = myTextFrames.Item(I)<br />' you don't need to get reference to ALL TextFrames in EACH iteration<br /><br />Set myCurrentFrame = myDocument.TextFrames.Item(I)<br />' get reference to Ith TextFrame in document<br /><br />' If myCurrentFrame.Texts.ItemByRange (1,7).Contents = "<Place:" Then<br />If left(myCurrentFrame.Texts.Item(1).Contents,7) = "<Place:" Then<br />' looks better and should be faster<br /><br />   ' Set myLastCharacter = myCurrentFrame.Characters.Item(-2)<br />   ' myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents = ""<br />   ' you don't need these lines - you will delete contents in PLACE line<br />   <br />   ' myCurrentFrame.InsertionPoints.Item(1).Place ("E:\sxs\pm65\Sundco.jpg")<br /><br />   myFile = Mid(myCurrentFrame.Texts.Item(1),8)<br />   ' get all after "<Place:"<br /><br />   myFile = Split(myFile,">")(0) ' get all to ">"<br />   ' small trick ;) when split - get array - but we can use (0) to refere to first element<br /><br />   myCurrentFrame.Texts.Item(1).Place(myFile)<br />   myCurrentFrame.Fit idFitOptions.idProportionally<br />End If<br /><br />Next<br /><br />and I don't think that iterating TextFrames collection is good way ...<br />you should iterate Stories collection and refer to first TextFrame - unles you are sure what you are doing ;) and you have Stories where each TextFrame will have image inside ...<br /><br />robin<br /><br />-- <br />www.adobescripts.com

  • Error occured while importing xsd.file(Name contains invalid characters: -

    Hello,
    i muss import xsd.file.  while importing this error occured:
    İFMEXTDEF CCTS_CCT_SchemaModule-2.0 | http://example.org/XXX/XXX/OUT/NOZ (SC_NOZ V001 of example.org):
    Name contains invalid characters: - .
    Only a(A)-z(Z), 0-9, and "_" are permitted
    This xsdfile name is CCTS_CCT_SchemaModule-2.0 but PI doesn't  accept "-". But i muss use this file because this file is standart. What can i do for this?
    Thanks
    Nurhan
    Edited by: Nurhan on Oct 18, 2011 11:22 AM

    HI,
      PI doestnt support special characters like '-'. first you need to change the file name as you specify '-'. to remove that and you have to give '_'. then uyou have to impot >XSD file into ESR under ExternalDefination.
    i hope this will help you.
    regards,
    ganesh.

  • Music files in the Finder: File Names Obscured

    OS X 10.10.2.
    When I search for music in the Finder, it returns metadata titles instead of the file names.
    The reason I do a music search in the finder is to sort and edit the actual file names. Not happy.
    General, Finder and Spotlight preferences just shrug at me.
    Any ideas?

    BeeblePete wrote:
    If so, that's really unfortunate. It means I can't use search to see and resolve duplicate or inconsistent file names. It kind of dilutes the Finder's role as a file manager, when there's already an app for managing the metadata (iTunes).
    Well, in Apple's world, you don't manage files. You manage Music, and Photos, etc.
    If you just open a Finder window without searching, you can manage the files as files.
    The best solution I can think of for the duplicates is to turn on the status bar. If you create a search folder for kind:music and sort by name, you'll see all the duplicate titles. When you select one, it will show the path at the bottom of the window, including file name. You can arrow between the files to determine where you have duplicates and delete or move as desired.

  • ORA-15124: ASM file name contain invalid alias name after creating standby

    OS level: redhat 5
    db version: 11gr2
    I just created a standby using rman duplicate from active database and the rman duplicate ran successful.
    Then I modified parameter files on standby to include the current controlfile and try to start the db as mounted, I got following error:
    SQL> startup mount;
    ORA-15124: ASM file name '+DAT/prds/controlfile/current.913.794712357, +FRA/prds/controlfile/current.5616.794712357' contains an invalid alias name
    SQL> exit
    I could not figure out what went wrong here.
    Those are two most current controlfile created during duplicate of db.
    I double checked everythng, everything else seems working.
    What should I look at now?
    Thanks for help as always.

    SQL> startup mount;
    ORA-15124: ASM file name '+DAT/prds/controlfile/current.913.794712357, +FRA/prds/controlfile/current.5616.794712357' contains an invalid alias name
    SQL> exit
    The parameter control_files in pfile/spfile should have value as '+DAT/prds/controlfile/current.913.794712357','+FRA/prds/controlfile/current.5616.794712357'
    It looks like you have missed out the adding quotes to each controlfile path and you have specified both the files under one quote.
    *ORA-15124: ASM file name '+DAT/prds/controlfile/current.913.794712357, +FRA/prds/controlfile/current.5616.794712357'*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • InDesign CS4: File names change to string of numbers

    Occasionally, one of our users will save an InDesign CS4 file, only to have the file name change.  For example, a file originally named "#kwn25501.bcbsNM.indd" was saved as "#kwn25501.bc157-1223857848."
    If the user is not aware that this has happened, things can go horribly, terribly wrong in our production environment. The "numbered" file may be missing key elements, or be somehow be corrupt in some fashion. In one case, this led us to having to reprint a job because the "numbered" file was missing a photo; somehow, that file was used (and perhaps renamed after the fact) to create the final output.
    We use Macs running InDesign CS4 6.0.5. Some of our Macs are running Tiger 10.4.11, while others are running Leopard 10.5.8. The problem seems to related to the Leopard machines, although that is not 100 percent certain at this point. All of these Macs are bound to Active Directory and save files to a Windows 2003 server. I know Adobe recommends against working on files over a network, but perhaps there is an explanation for this file renaming aside from network issues.
    Any light that can be shed on this issue will be greatly appreciated. Thanks!
    Kevin Stauffer

    Check to see if maybe your original filename is the problem.
    You may need that particular name for a workflow reason, but some of the symbols in the middle of your filename are generally not a good idea. Especially working off of a server, file names should be ONLY alpha-numeric characters, no symbols, no periods (except for the file type) and only underscores or dashes to separate words, no spaces.
    The reason is some of those symbols get picked up as machine language and all sorts of bad can happen as a result.
    Message was edited by: Michael Riordan

  • Annoying new Finder file name editing setting

    This is new in Leopard and it is beginning to annoy me very much. It happens when editing file names in a sub-folder view – the one where the expand arrow is expanded.
    When editing a long file name I am used to using the arrow keys (up places the insertion point at the beginning; down places it at the end; left and right move it left and right). Hold down the left arrow key to get to the middle of the text quickly and the sub-folder closes. Previous to Leopard the command key+left arrow did this, not just the arrow on it's own. This means that you either have to use to mouse to click where you want to edit, or press the left arrow key multiple.
    I have the key repeat rate set to high so the insertion point moves quickly.
    Has anyone else seen this?

    Yes, it's a bug. Please report it to the link below - the more the merrier:
    http://developer.apple.com/bugreporter/
    On the bright side, at least they finally fixed Option-Right Arrow for disclosure triangles.

  • Finder file name display

    None of my files in a finder window are arranged in alphabetical order. How can I re-arrange them into alphabetical order? Thanks in advance.

    Arranging by name doesn't seem to list files alphabetically if your view mode is 'columns' - it works in the other modes - does anyone have the same problem and if so how to fix it? Any advice would be much appreciated

  • How to find files starting by a string?

    Hello.
    I need a way to read all files in a directory whose names start with a string in order to update a field in a table. I wonder if there is a way of doing that in pl/sql.
    As this procedure will be called in a shell script I guess I could do that in shell script but I don't know how to do that.
    Can someone help me?
    Thanks anyone.

    Yes Kamal, as an old Unix user, I don't like spaces within names, and normally I don't use them :-)
    but the problem can be solved :
    $ ls -l va*
    -rw-r--r--  1 oracle oinstall 240813 27 ago 10:39 valind.sql
    -rw-r--r--  1 oracle oinstall    283 18 feb  2005 val.sql
    -rw-r--r--  1 oracle oinstall     62  5 dic 18:52 var 123.txt
    -rw-r--r--  1 oracle oinstall    154  5 set 17:16 var1.sql
    $ cat disp.sh
    ls va* | while read FILE
    do
            sqlplus -s scott/tiger << EOF
    set serveroutput on
    exec disp_file('$FILE');
    exit
    EOF
    done
    $ ./disp.sh
    valind.sql
    PL/SQL procedure successfully completed.
    val.sql
    PL/SQL procedure successfully completed.
    var 123.txt
    PL/SQL procedure successfully completed.
    var1.sql
    PL/SQL procedure successfully completed.
    $                                                                                          

Maybe you are looking for

  • How to call Copy.GetItem Method in Excel vba function

    Hi, I want to use sharepoint copy services to download/upload or retreive field information of a sharepoint file. For that i want to sharepoint web services. One class among them is copy. I want to call the GetItem method present in that class. Think

  • Primavera p6 v7 Tested configuration

    I am planning a Primavera P6 v7.0 implementation. Our preferred platform and database is MS SQL server 2008 R2 on MS windows 2008 R2. We also use Citrix Xen App 6.0. This does not appear to be a tested configuration - is anyone using this config' and

  • News YTD, YTD LY, MTD measures in OBIEE repository

    Hello All, I wanted some help in creating the following kind of measures: 1) YTD LY E.g if today is 25/12/2013 It should give the total of all sales from 01/01/2012 to 25/12/2012 2) YTD E.g if today is 25/12/2013 It should give the total of all sales

  • Logic keeps crashing on 1 project file

    Hey guys, I haven't posted here before, but learnt tons from all the other! I've got a problem with one project file which keeps crashing about 2 mins into editing. There doesn't seem to be any pattern to what makes it crash...it just freezes with th

  • New computer...Windows 7...I'm used to Mozilla as my web browser...I can't get to the homepage. What am I doing wrong?

    I got a new computer yesterday and am now using Windows 7 (ugh). I want Mozilla Firefox as my browser. I downloaded it and it's showing up on my All Programs but I can't seem to get to the homepage.