RegEx to ID file path that uses Wildcard appropriately

I am looking for a Regex expression to identify paths with wildcards, but pilchards only allowed in the file name and extension portion of the path. So both of these should return true
C:\Path\*.*
\\SRV\Path\*.txt
However, \\*\Path\*.* should return false since a wildcard anywhere but the end is invalid.
My Google Fu has failed me, as all my searches are coming up with discussions of wild cards in the RegEx, rather than * occurring in a specific pattern. 
To give some context, I have a Copy function that is going to take Source and Destination arguments, as well as optional Breadcrumb and Overwrite arguments, and it will handle the actual copy differently depending on the source being a file, folder or wildcard
and destination being a file or folder. And of course it will return an error in the log if the destination is a wildcard.

I couldn't figure out a way to do it with regex, although I did learn a lot about regex in the process.  For anyone else that might find this thread, here is the best link I've found explaining regex:
http://www.freeformatter.com/regex-tester.html
Unfortunately, it wasn't good enough (or I'm just not smart enough) to puzzle this one out.  The following code works, but is obviously much less elegant than a straight up regex.  I post it only because I spent the time on it and if it can ever
possibly help anyone, it was worth the effort:
$a = "\\path\folder\job*.*","\\path\fo*lder\star.tar","c:\path\folder\bo*lder\f*","c:\blah\blah.txt","\\blah\blagaa\blahgahah\a\f\*"
Foreach ($target in $a) {
$flag = $null
$path = $target -split ("\\")
$count = $path.count
If ($path[$path.count -1] -match "\*") {
Foreach ($index in 0..($path.count -2)) {
If ($path[$index] -match "\*") {$flag = 1}
If (!($flag)){$target}
PS C:\Users\user> $a = "\\path\folder\job*.*","\\path\fo*lder\star.tar","c:\path\folder\bo*lder\f*","c:\blah\blah.txt","\\blah\blagaa\blahgahah\a\f\*"
PS C:\Users\user> Foreach ($target in $a) {
>> $flag = $null
>> $path = $target -split ("\\")
>> $count = $path.count
>> If ($path[$path.count -1] -match "\*") {
>> Foreach ($index in 0..($path.count -2)) {
>> If ($path[$index] -match "\*") {$flag = 1}
>> }
>> If (!($flag)){$target}
>> }
>> }
>>
\\path\folder\job*.*
\\blah\blagaa\blahgahah\a\f\*
That being said, I'm eager to see the 10 character or less regex expression to do it that someone is sure to post soon and make me feel silly.
I hope this post has helped!

Similar Messages

  • Can I change the file path that itunes reads my music files from? 65000 files trying to be transferrd from external to internal HD. I dont want itunes to manage my collection, just read it. thanks

    Can I change the file path that itunes reads my music files from?
    I have about 65000 music files that i have transferrd from my external to a new laptop internal HD.
    I have organised the folders myself as I use a PC and do not want itunes to organise the folders because when I'm searching through music on windows it is sorted out by artists/albums with 'the...(eg  The Beatles)' under 'T' instead of 'B'.
    Long story short.... Is there any way that I can keep my itunes library as it is on the external HD and copy it to the new laptops C drive, keep all the info (playlists etc) and still have the same folder structure as on the external HD?
    Or, is there any way of making windows sort things in alphabetical order like it is in itunes (eliminating the 'the' issue)?

    The files that weren't inside the media folder on the original machine need to be copied over to exactly the same paths as they had on the source machine. See this thread for an ongoing discussion of a similar problem. See also this post on migrating the iTunes library.
    tt2

  • Problem launching Firefox from Windows with file path that contains space characters in the html file's file name

    We have a software application that programmatically launches the default web browser using the Windows shell execute function ("ShellExecuteA" in the "shell32.dll" library of the Windows API) along with a file path for a saved local html file that is to be displayed. In the case that FireFox is the default browser and the file path for the html file contains any space characters in the html file's file name, Firefox (in this case v7.01) will display an error message "File not Found..." and then will also proceed to open tabs for each of the individual words in the file name, launching as the URL path, each individual word appended to ".com".
    In the following example, the path "C:\KSSecOfState\Forms\Kansas Secretary of State - Filings and Forms.htm" when launched programmatically, resulted in the error message "File not Found...Firefox can't find the file at /C:/KSSecOfState/Forms/Kansas." and opened up browser windows for "http://www.secretary.com/", "http://www.of.com/", "http://www.state.com/", "http://www.and.com/", and attempted to launch "http://forms.htm". If the same file (renamed) is launched using the path string "C:\KSSecOfState\Forms\KansasSecretaryOfState-FilingsAndForms.htm" the file opens up correctly in Firefox. Clearly the presence of spaces in the file name is causing the problem.
    I should also note that either path (with or without space characters) works properly if pasted directly into the Firefox URL path menu bar for a live instance of Firefox. The test path strings I used were:
    C:\KSSecOfState\Forms\KansasSecretaryOfState-FilingsAndForms.htm
    C:\KSSecOfState\Forms\Kansas Secretary of State - Filings and Forms.htm
    Does anyone know anything about this problem or how to work around it (other than the obvious answer of taking the spaces out of the file name which is not possible for this application). It seems the problem is specific to Firefox. IE works properly if launched programmatically with spaces in the file name passed to it. I haven't tested other browsers yet.
    Thanks!

    If starting from ShellExecute works the same as starting from the command line then there are two options:<br>
    Put everything inside double quotes<br>
    '''C:\Program Files\Mozilla Firefox\>'''firefox.exe '''"c:\test\svg test.htm"'''<br>
    Convert to a valid url with file:// protocol and percentage-escaping the space<br>
    '''C:\Program Files\Mozilla Firefox\>'''firefox.exe '''file://c:\test\svg%20test.htm'''<br>

  • UCCX 8 file paths for using java methods

    UCCX 8.0.2SU4
    I am trying to use java methods to read an xml file out of the Document repository.  I was able to do this in UCCX 7 and prior, but in 8 it seems i need a different file path syntax for the 'java.io.file' variable.
    Example:
    I would like to do the following:
    javaDoc =  new java.io.File(/opt/cisco/uccx/Documents/User/default/mydoc.xml)  
    doesFileExist = javaDoc.exists()
    I am not having success with these steps, as the result is always false, even though the file does exist.
    any help is appreciated.
    thanks,
    Mike

    Your access to the file system is severly restricted. There are security measures in place that only allow you access to the "customer directory". You'll want to use a Create XML Document step to retrieve a file from the document repository using the DOC[/folder/file.xml] syntax. Note the root (i.e. the first forward slash) is the root of the document repository as seen in the /appadmin UI.
    Please remember to rate helpful responses and identify helpful or correct answers.

  • Full file Path when using FormFile in struts

    hi,
    i am uploading an excel file. All is doing fine but whatever file is selected by user by clicking the browse button, its does not retreive full path it retreives only the file name selected......
    JSP page
    <html:form action="uploadFile.do" method="POST" enctype="multipart/form-data">
         <html:file property="fileName" title="Browse" />
         <html:hidden property="methodtoinvoke" value="uploadFile" />
         <html:submit value="submit" />
    </html:form>when i retrieve this filename and convert it to String its only shows file name and not the full path, as a result it always pick this file name from the current working directory.
    how can i get the selected file path ????
    Pls help
    thanx

    What would do a server side program that processes the file upload do with the client side path of the file?
    The server side process (your Action class) would receive a stream of bytes (multipart data) that contains the file's contents as well as other info like size, content type etc.
    ram.

  • Method to get the file path that invoked a servlet

    i have a html file that invokes a servlet.Within the servlet i want a method that gives me the path of the html file.Is this possible without using cookies.or is there any method that serves my purpose?

    Hi,
    after reading the last posts I think you should try what KPSeal said (althought I haven't tried it) or use my last suggestion :
    on your HTML link (which will be handled by server) add an extra parameter (e.g. http://handle.xxx?page=mypage.HTML) and catch it inside the servlet code to know from what page it came.
    nevertheless, about the getRequestURL() (and getRequestURI()) it's a method from the interface HttpServletRequest, in the package javax.servlet.http that comes in the Servlet API. (you can find the servlet API at http://java.sun.com/products/servlet/download.html), but I believe if you have a servlet you already should have inside it the request object.

  • Can relative file paths be used in export presets?

    Hello,
    I currently use a folder structure in Lightroom that looks like:
    YYYYMMDD-Event
    -->Original
    -->Selects
    -->Output
    I copy original files into YYYYMMDD-Event/Original/, do basic corrections and culling, and export to YYYYMMDD-Event/Selects/.  I do the same thing when exporting from Selects to Output...  I have tried using the "Same Folder as Original Photo" with a subfolder of "../Selects", but i get an illegal character message.  Is there a way to use relative paths in export presets?  I'm not against using publishing services to accomplish this, but I am having the same problem...
    Thanks in advance for the help.

    @Designer1976 – if you place an AI logo in InDesign and move that placed logo to a CC Library, it should behave like any other image you move to a CC Library. Other people who have access to your CC Library could place the logo, print it, export to PDF, if the file is available on a mutual network drive or a cloud drive like Dropbox etc. And of course, if the loaded file is synched which can take a moment, if you just moved it to a remote drive in the cloud.
    I tested this with eps file types.
    AI files (PDFs with AI code embedded) placed in InDesign should make no difference.
    However:
    1. If I placed an eps file in InDesign
    2. Moved the eps file to my Dropbox account
    3. Came back to InDesign
    4. Relinked the placed eps with the one in my Dropbox
    (all good now in the perspective of an InDesign document)
    I was not able to add that relinked eps file to my CC Library.
    By trying I only heard a "blip" or so. And nothing was added.
    To make it work, I first had to:
    1. Save the InDesign document
    2. Close the document (maybe optional, can't remember)
    3. Reopen the document (maybe optional, can't remember)
    Then I could add the placed eps to my CC Library.
    After that it worked like it should.
    Not as seamless as it should be…
    Uwe

  • Can a full file path be used to open a sql database connection?

    I have a requirement to open an unattached sql server database file with a given path. Can this be done?
    This would be similar to opening a Jet database using the path as the Data Source.  For example, the path might be "C:\MyFolder\MyDatabase.mdf".  I need to put the path in the connection string and open the database.  It would look
    something like the following.
    Provider=SQLOLEDB;Data Source=C:\MyFlolder\MyDatabase.mdf;Itegrated Security=SSPI;
    Rob E.

    I don't think its possible with unattached file.
    http://www.connectionstrings.com/sql-server-2008/
    --Prashanth

  • How do I set the default file path for the Place command?

    I keep my graphics files for each document in a particular folder. Every time I open an existing InDesign document and place a new image I have to browse back to that location - even though all of the previous images in that document came from the same folder. InDesign does not remember the file path that was used previously in the document. This is very annoying.
    IS THERE A WAY TO SET THE DEFAULT FILE PATH, OR LOCATION, FOR IMAGE FILES?
    I have looked through the preferences, searched the forums and internet, but I have not found any reference to setting default paths. Is there a setting like the one in MS Word called "File Locations" on the Options toolbox?
    Thank you.

    Since you're working in ID on Windows, you can take advantage of a neat trick in Windows. Copy the file path out of the File Explorer address bar and paste it directly into the Place filename field. That will jump you directly to the desired volume. For example, let's say I want to place a graphic located at X:\PS Jobs\May PS\709672bp\Working Source Files\Links. I copy that entire path from the File Explorer address bar, go to InDesign, select File|Place, and press Control + V to paste that path into the filename field. I press the Open button and Shazam! I'm there instantly, without a bunch of navigation.
    You can do the same thing in the File|Save As and File|Export fields. Let's say you want export a PDF file from InDesign to the volume X:\PS Jobs\May PS\709672bp\Working PDF Files. First copy the desired file path from the File Explorer window. In InDesign, select File|Export, click anywhere in the filename field, and press the Home key to move the insertion point to the front of the filename. Press Control + V to paste that path in front of the filename, then add the backslash character (\). The filename will now look like this: X:\PS Jobs\May PS\709672bp\Working PDF Files\Filename.pdf. Press the Save button to bring up the Export Adobe PDF window. Select your desired PDF preset, press the Export button, and the PDF file will magically appear in the desired volume.
    This sounds really complicated, but it's not. In practice, it only takes a few seconds. I probably save an hour's worth of needless navigation every day with this technique.

  • File path for application server file

    Hi All,
                 I have a file 'abc.doc' stored on the application sever.
                I want to crate a document using the BAPI_DOCUMENT_CREATE and store this file
                What is the file path that I need to pass into the bapi.
    Please help
    Warm Regards
    Sunil Kumar.

    Hello Sunil
    You are right. That's the file path you should specify. It looks like your application server is running on UNIX platform. You can use transaction AL11 to locate your file and specify the file path in normal unix format. If this doesnt work, you can try prefixing your file path with "file:// ".
    Cheers
    Anand

  • File Path in Bridge Contact Sheet?

    Does anyone know how to add the complete file path to the caption in Bridge/InDesign contact sheets? I'm using Bridge & InDesign CS3 for Windows. I know I can get all the files in subfolders by using the flattened view in Bridge to make my contact sheet, but I still need to know each image's location once it's on the contact sheet. It seems like this should be pretty a pretty basic task. Any help?

    Hi DeNoveau,
    I was struggling with this same issue. I found a solution that is somewhat helpful. Not ideal but better than nothing.
    1. Create the InDesign contact sheet as you normally would.
    2. Choose Window > Automation > Scripts
    3. In the Javascript folder, find LabelGraphics.jsx
    4. In the panel that comes up, choose File Path
    That should do it. As I said, not ideal but better than nothing.

  • How to assign the downloaded file path in dropdown menu dynamically?

    I have one jsp page. In that jsp page one dropdown menu is there. Dropdown menu contains "save" and "saved content". I download the file using "save" option in menu. That downloaded file path is assigned to the below of the "saved content" option. Then i clicked that downloaded file path, that file will be open.
    My problem is how to assign the downloaded file path in dropdown menu. plz help me.

    dittu wrote:
    My problem is how to assign the downloaded file path in dropdown menu. plz help me.I don't understand your problem.

  • Specify File Path in Email

    Hi,
    I am trying to specify a file path in an email so that when the receipent open the email, s/he can just click on the file path that I specified in the email and open the file.
    On Windoze, I can type something like (I might not type the syntax completely correct):
    <file:\\the full path>
    On OSX, how could I achieve the same?
    I researched many articles but I can't find any way to do this. The closest that I found was something like:
    file:///the full path
    But the above doesn't work at all.
    Any suggestion?

    Thanks Rafe.
    I have actually found a way to make this work in Apple Mail.
    The solution is to use "Hyperlink" option in the mail. The link will use "file:///the path" syntax. This will work, but not very pretty (since it can't show the full path). But I will take it.
    Thanks.
    Hi Mark,
    I just created a temporary text file on my Desktop
    titled "test.txt". In Safari, I typed in the
    following address:
    file:///Users/rafe/Desktop/test.txt
    Kind of interesting to watch the address icon change
    as I type the address in, from a hard-drive to the
    Users folder to my Desktop folder.. Anyway, I then
    wrote myself a plain text email with the above
    address in the body, using Apple's Mail application.
    Sure enough, when I received the email I was able to
    click the address and the document automatically
    opened in TextEdit.

  • LAN Setup - File path for WritExtFile function

    Hello:
    I am currently using the WriteExtFile function and am
    wondering if I need to access a file located on another computer am
    I able to use this function. e.g. is there a proper file path that
    I can enter into the first parameter of the WriteExtFile to
    recogonize a data file located another a networked computer? The
    computer will be using windows XP. Any help would be
    appreciated.

    Yes, you should be able to use WriteExtFile to a networked
    location. The
    way I've done it in the past is to share a folder on the
    other computer on
    the network, then map that shared folder as a drive on the
    first machine.
    Then the path is that drivename^":\\"^RestOfPath...however
    you want to set
    it up.
    There is some admin that has to take place on the networked
    machines - to
    wit: sharing the write location and mapping the shared
    folder. You have to
    be careful about permissions and accounts when using XP,
    also. Be sure that
    the admin that sets up the share leaves it open to all the
    potential
    machines and user accounts that are likely to want to write
    to the shared
    location.
    Let me know if I can provide more details. Also check the
    search criterion
    'LAN' or something similar on the AWARE list archines.
    -Marc Lee
    "nickpatel" <[email protected]> wrote in
    message
    news:eu1ekg$3gb$[email protected]..
    > Hello:
    >
    > I am currently using the WriteExtFile function and am
    wondering if I need
    to
    > access a file located on another computer am I able to
    use this function.
    e.g.
    > is there a proper file path that I can enter into the
    first parameter of
    the
    > WriteExtFile to recogonize a data file located another a
    networked
    computer?
    > The computer will be using windows XP. Any help would be
    appreciated.
    >

  • File path in CV01N transaction

    Hi,
    I'm basically a ABAP programmer. I dont know much about the AutoCAD.
    Our requirement is, in CV03N transaction, we have the reference file path which is having the file path of the drawing. This is looks like a windows file path. I beleive generally all these drawings will be stored in a shared file server like
    Common-server\All-drawings\Draw1.drw. Now the question is  if we have changed the file server, like "Common-Server1" in this case, we have to change all the file paths that are already have the old file path to the new file path.
    Is there any way to avoid this? I mean can we have some alias name or something which we'll enter in the file path value while creating the document using CV01N so that we can avoid the rework of changing the file path for all the documents.
    And also I would like to know how can we change this file path for the existing documents? I saw a FM BAPI_DOCUMENT_CHANGE, but I couldnt get exactly what I need to pass for this BAPI.
    Can you please help me in this?
    If the question is not clear, please let me know.
    Thanks,
    Kishore

    you can also assign a driveletter instead of working with the UNC path (you're file server administrator can arrange that). it the servername changes in the future the path remains the same. only the systemadministrator has to change the inlog script so the driveletter assignment points to the new servername.
    with BAPI_DOCUMENT_CHANGE you pass the document info record data on the import paramaters and the file path in the tables section on DOCUMENTFILES
    so you define a table as type BAPI_DOC_FILES and fill it with the file path and other relevant variables accordingly. you clear it for every document info record.
    (the reason for passing filepaths in a table is because you can have more than 1 file in 1 document info record)
    and what is it otherwise that you couldn'get what you needed
    here some old code from my import programm for passing the filenames to the function (jhe I know I have to use a workarea by now)
    t_bestand type BAPI_DOC_FILES occurs 0 with header line,
    loop at it_dms_import.
       clear s_docdata.
        move 'Z01' to s_docdata-DOCUMENTTYPE.
        move '00' to s_docdata-DOCUMENTVERSION.
        move '000' to s_docdata-DOCUMENTPART.
        move it_dms_import-zapplic to s_docdata-WSAPPLICATION1.
        move 'Tekeningen VU (calc) ' to s_docdata-DESCRIPTION.
        move it_dms_import-zstatus to s_docdata-STATUSINTERN.
        move it_dms_import-zstatus to s_docdata-STATUSEXTERN.
        move it_dms_import-bestand to s_docdata-DOCFILE1.
        clear t_bestand.
        refresh t_bestand.
        move it_dms_import-zapplic to t_bestand-WSAPPLICATION.
        move it_dms_import-bestand to t_bestand-DOCFILE.
        append t_bestand.
       CALL FUNCTION 'BAPI_DOCUMENT_CREATE'
          EXPORTING
            documentdata               = s_docdata
    *       HOSTNAME                   = ' '
        IMPORTING
    *       DOCTYPE                    =
            DOCNUMBER                  = docnr
    *       DOCPART                    =
    *       DOCVERSION                 =
            RETURN                     = foutcodes
          TABLES
            CHARACTERISTICVALUES       = t_kenmerk
            CLASSALLOCATIONS           = t_classalloc
    *       DOCUMENTDESCRIPTIONS       =
    *       OBJECTLINKS                = t_equipment
    *       DOCUMENTSTRUCTURE          =
            DOCUMENTFILES              = t_bestand  "ADS 24102005 uitsluiten ivm import calcs
    *       LONGTEXTS                  =
    endloop.
    kind regards
    arthur
    Message was edited by:
            A. de Smidt

Maybe you are looking for

  • How to get the Definition from a source using WSIF

    Hi All, Definition def = WSIFUtils.getDefinitionFromLocation("http://bingweb.binghamton.edu/~npandya1/nirav/" , "GlobalWeather.wsdl"); but its giving me an error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/L

  • Airplay will not recognize a second AppleTV unit that I just purchased.

    I just purchased a second AppleTV unit and have set it up in our familyroom. The setup went well and all the connections and home sharing of two iTunes libraries have been completed and are working as they should. The only problem is with Airplay. In

  • How to connect to yamaha disklavier mark III

    I have a macbook pro and want to play midi files on my yamaha disklavier piano.  I have installed the yamaha UX16 driver and made the connections.  The macbook pro recognizes the disklavier as an attached device.  I cannot get anything to go from the

  • IOS 8 update and playing music in car

    SSince I upgraded to iOS 8 yesterday, my iPhone 5 no longer plays music in the car. It connects and I can make and receive calls via Bluetooth and it shows my phone on the screen but then just says Play underneath. I can't get the music to play.

  • UNABLE TO CONNECT TO THE DATABASE

    Problem Description: Unable to connect to the database: http://192.168.1.94:1158/dva/mac/login Login to Database: * User Name : dvowner * Password : XXXXXXXXXXX Login Error TNS:listener does not currently know of service requested in connect descript