Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Trim problem

    Hi, i have another complex problem i cannot figure out. I have a string called
    #file_name#. The string's value is a filepath and file name of a file. Like
    this. <cfset file_name = 'e:\www\root\files\fileone.zip'> What im trying to do
    is remove the path and leave the file name from the string. So i could use
    another string that would only consist of the file name. (fileone.zip) The
    reason why i need this to be auto is because i will never know what the path or
    filename will be. Thanks for your help. Tony Paolillo

    TonyP Guest

  2. Similar Questions and Discussions

    1. trim function
      Hi there, does any know how i can do a 'trim on canvas' sort of function. If my canvas is bigger than my draw/animation etc, then how do i shrink...
    2. problem with the trim() function
      I am working on a german website and I have a username called "zartbitters??". When I use the #trim(username)# it removes the german letter ?. The...
    3. Need to Trim value in a List
      I have a list that retrieves documents in a directory. <!--- Pack Directory ---> <cfdirectory action='list' directory='C:\TNS_Docs\EXCEL_PACKS'...
    4. Problem Printing Trim marks on Epson 777i
      Interesting. Used the trim marks and they did print. I was on a printer called "Canon 860" I think and the printer stopped working so I switched over...
    5. trim string
      How do i cut the last 4 characters in a string? I know how to cut the 4 first, but i need to cut the last! I have a image name like testimage.gif...
  3. #2

    Default Re: Trim problem

    This works: <cfset file_name = 'e:\www\root\files\fileone.zip'> <cfoutput>
    <cfset iPos = find('\', '#file_name#')> <cfloop condition = 'iPos is not 0'>
    <cfset file_name = #Right( file_name , Len( file_name ) - iPos )#>
    <cfset iPos = find('\', '#file_name#')> </cfloop> </cfoutput>

    jgould Guest

  4. #3

    Default Re: Trim problem

    Thanks Jeff. That seemed to work, execpt it took off teh .zip from the file. Any ideas how to get that back?

    Thanks
    TonyP Guest

  5. #4

    Default Re: Trim problem

    The code I posted didn't take the '.zip' off. Are you sure you had the .zip in your original file_name variable?
    jgould Guest

  6. #5

    Default Re: Trim problem

    My bad, your right. I had a typo. It works perfect!

    Thanks for your help.

    Tony
    TonyP Guest

  7. #6

    Default Re: Trim problem

    > This works: <cfset file_name = 'e:\www\root\files\fileone.zip'> <cfoutput>
    > <cfset iPos = find('\', '#file_name#')> <cfloop condition = 'iPos is not 0'>
    > <cfset file_name = #Right( file_name , Len( file_name ) - iPos )#>
    > <cfset iPos = find('\', '#file_name#')> </cfloop> </cfoutput>
    Chr*st on a stick, why on earth would you do all that?

    And what are the <cfoutput> tags doing in there? You're not outputting
    anything.

    getFileFromPath().

    [url]http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/functi95.htm#wp1104998[/url]

    --

    Adam
    Adam Cameron Guest

  8. #7

    Default Re: Trim problem

    Cool. I didn't know about that. You are obviously much smarter than me and a MUCH bigger sh*thead too.
    jgould Guest

  9. #8

    Default Re: Trim problem

    > Cool. I didn't know about that. You are obviously much smarter than me and a MUCH bigger sh*thead too.

    I'd quite like to know why I'm a sh*thead simply because I pulled you up on
    giving someone some *really bad* advice as to how to solve an issue?
    --

    Adam
    Adam Cameron Guest

  10. #9

    Default Re: Trim problem

    Simply because your attitude sucks. My way worked, Your way was better. But
    the way you decided to point that out makes me wary of ever attempting to help
    someone again. Carry on. I'm on to other things.

    jgould Guest

  11. #10

    Default Re: Trim problem

    im with you jgould, I took how Adam said that a bad way also. I do appreciate
    your advice and im still using it. Dont stop helping others, we need people
    like you that know what we dont and want to help. (Chr*st on a stick) lol
    Tony

    TonyP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139