Change Filenames with blank spaces in the Filename

I want to change many filenames with blank spaces and replace
blank spaces with underbar character.
Example:
File One change to File_One
File Two change to File_Two
Here is my script:
for file in `ls`
do
i=`ls -1 *" "*`
b=`ls -1 *" "* | sed -e s/\ /_/g`
done
mv "$i" $b
Please advise what is wrong with my script that isnt
working. The script works if I only have one filename
with a blank space. But if I have several filenames
with blank spaces in the name then it doesnt work.

I want to change many filenames with blank spaces and replace
blank spaces with underbar character.
Example:
File One change to File_One
File Two change to File_Two
Here is my script:
for file in `ls`
do
i=`ls -1 *" "*`
b=`ls -1 *" "* | sed -e s/\ /_/g`
done
mv "$i" $b
Please advise what is wrong with my script that isnt
working. The script works if I only have one filename
with a blank space. But if I have several filenames
with blank spaces in the name then it doesnt work.

Similar Messages

  • Playing a DRM (FMRMS) protected .flv with a space in the filename fails on OS X

    As the subject says, when trying to play a DRM encrypted .flv with a space in the filename it fails on OS X it works on Windows and I am 99% sure it works on Linux as well.
    I changed my files to not include a space but it appears now that if there is a space in any part of the path as well it fails.
    If anyone has an idea on what to do it would be appreciated.
    I have tried to use the File.nativePath and File.url properties after confirming that File.exists returns true.
    I tried escaping the spaces manually with + and %20 but none seem to work.
    The error is that the file just doesn't seem to play.  I will update this question if I find any more information.
    Thanks
    Glen.

    As the subject says, when trying to play a DRM encrypted .flv with a space in the filename it fails on OS X it works on Windows and I am 99% sure it works on Linux as well.
    I changed my files to not include a space but it appears now that if there is a space in any part of the path as well it fails.
    If anyone has an idea on what to do it would be appreciated.
    I have tried to use the File.nativePath and File.url properties after confirming that File.exists returns true.
    I tried escaping the spaces manually with + and %20 but none seem to work.
    The error is that the file just doesn't seem to play.  I will update this question if I find any more information.
    Thanks
    Glen.

  • Firefox 3 cannot download files with white space in the filename

    When opening attachments in e-mail Firefox is unable to handle files with white space in the name. This is not the same as the white space file name truncation problem documented on this site (where file names with white space are truncated on saving.) The issue is that the browser will prompt to allow the file to be saved, but it will not prompt to open the file as an option. If I rename the file to remove white space then I do receive the "Open with..." dialog box. I verified that Firefox 2 did not have this problem and I can open attachments with white space in the file names just fine using that version of the browser (2.0.0.20).
    == This happened ==
    Every time Firefox opened
    == Upgraded to version 3

    When a user clicks on an attachment with spaces, the filename is truncated to the first whitespace. While IE, Chrome & Safari handle this, Firefox refuses to accept mime headers with unquoted filename parameters. According to Firefox's bugzilla/knowledgebase, Firefox's behavior is the correct behavior and it's a problem with most webservers or web applications. This problem can be easily corrected by surrounding the filename parameter with double quotes.
    Eg.
    Response.AddHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");

  • String Manipulation with blank space at the end

    Hi All,
    DATA:  str1(999),
           a(10),
           b(10).
    DATA: len TYPE i.
    a = 'Welcome'.
    b = 'To all'.
    CONCATENATE a b INTO str1 RESPECTING BLANKS.
    len = STRLEN( str1 ).
    WRITE: len.
    result : 16.
    If I declared str1 as string result is 20. Because in above case empty space is truncated at last .
    So any otherway to getting result 20 with out declaring str1 as string.

    Hi vinoth ,
    To get spaces at last  ,
    data : str1 type char10 ,
             len type i .
    str1 = 'the ' .                  " space given by pressing space bar button
    len = STRLEN( str1 ).     " in len we get it as 3 , coz 'the ' is 3 only .
    str1 = 'the ' .                 " space given by pressing ALT 2 5 5
    len = STRLEN( str1 ).   " in len we get it as 4 , coz 'the ' is 3 and 1 space is given by pressing ALT 255 .
    This works,
    Hope it might be helpfull,
    Regards,
    Aby

  • How do I delete the blank space at the beginning or end of a project?

    I constantly end up with blank space at the beginning or end of a project - how do I remove it?  I get this ALL the time and I jsut can't get rid of it.  Obviously I want my project to start at 0.00 not at 1.xx.
    Thanks.

    That's not a project. You're inside an multicam angle editor. You need to edit the multicam clip into a project. That's where you edit it.

  • Issue with FTP Adapter ListFiles files with spaces in the filename

    Hi
    I have an FTP adapter that does a ListFiles of all the files in a directory. It comes back and everything works fine however it removes all spaces from the filename meaning when I do the GET afterwards this fails as it is a different filename.
    The filename is a0eQ0000000wJVdIAM~1~ technote316.TIF note the space between ~ and technote.
    When a ListFiles is done I get the following request response in BPEL execution:
    <messages>
    <InvokeGetFilenames_FileListing_InputVariable><part name="Empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><empty xmlns="http://xmlns.oracle.com/pcbpel/adapter/ftp/CommonServices/SalesforceNotifcationServices/GetFileNameFromFTPServer"/></part></InvokeGetFilenames_FileListing_InputVariable>
    <InvokeGetFilenames_FileListing_OutputVariable><part name="filelist" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><filelist size="1" xmlns="http://xmlns.oracle.com/pcbpel/adapter/ftp/CommonServices/SalesforceNotifcationServices/GetFileNameFromFTPServer"><file><directory>/salesforce/006Q0000007yKcd</directory><filename>a0eQ0000000wJVdIAM~1~technote316.TIF</filename><lastModifiedTime>1305507120000</lastModifiedTime><creationTime>0</creationTime><size>1906643</size></file></filelist></part></InvokeGetFilenames_FileListing_OutputVariable></messages>
    This then follows with a GET that fails:
    <messages><input>
    <InvokeGETfile_SynchRead_InputVariable><part name="Empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><empty xmlns="http://xmlns.oracle.com/pcbpel/adapter/opaque/"/></part></InvokeGETfile_SynchRead_InputVariable></input><fault>
    <bpelFault><faultType>0</faultType><remoteFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'SynchRead' failed due to: No Data to process.
    No Data to process.
    File /salesforce/006Q0000007yKcd/a0eQ0000000wJVdIAM~1~technote316.TIF to be processed was not found or not available or has no content
    The invoked JCA adapter raised a resource exception.
    Please examine the above error message carefully to determine a resolution.
    </summary></part><part name="detail"><detail>550 /salesforce/006Q0000007yKcd/a0eQ0000000wJVdIAM~1~technote316.TIF: No such file or directory</detail></part><part name="code"><code>550</code></part></remoteFault></bpelFault></fault><faultType>
    <message>0</message></faultType></messages>
    I'm guessing its some use of the jca.message.encoding I can't find anything that really explains this though. Just the http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10231/adptr_propertys.htm link.
    Any help would be greatly appreciated.
    Thanks

    Hi PG,
    Is your private file in the form of Java Keystore (.jks)? I had used .ppk file and it was a success.
    If it is .jks in your case, try using the same password for private key as of keystore file (.jks). I hope you're not supplying any PASSWORD in the Adapter properties.
    Regards,
    Neeraj Sehgal

  • How can I load pics from camera without spaces in the filename (PSE5)

    Hello,
    I want to load the pics from my Fuji Camera with my newly acquired Photoshop Elements 5 into its database as simple as possible. I get offered several ways of renaming the pics during the import. Unfortunately the date formats offered (for folder or filenames) do *all* include space characters " ", which I do not like, because this caused me earlier a lot of trouble when putting the pics online, for example (%20 in the path name). Another reason is my existing photo collection since 2001, which has no spaces in the filenames as well.
    Example for the filename:
    PSE offers: "jj mm dd 001.jpg"
    I want : "jjmmdd_001.jpg" or at least "jj_mm_dd_001.jpg" or anything similar.
    For folder names the same thing appears.
    Is there a way to do that without typing each date without spaces by hand?
    How?
    I would like to have the photo load process as simple as possible, without having to remove the spaces with a separate rename tool.
    Any ideas?
    I searched for quite a while and I am surprised that nobody else seems to have this problem. Am I just too picky?
    Thank for any help.
    Greetings from Germany,
    Ulrich

    Ken,<br />again thanks for your writing.<br /><br />IMHO, if PSE had space free filenames, this would lead to a very simple and fast workflow with PSE alone (!) like this:<br /><br />1. Just connect my camera (Fuji F31fd) with the USB cable (no fiddling with the memory card in and out each time)<br />2. Transferring all (or selected) pics into PSE, one folder per day, named yymmdd_optional_theme_description.<br />3. Delete all non-optimal pics after viewing in PSE. Then tagging, pic-improving where needed ....<br />4. As backup, burn/move to CD from time to time and copy/move to an external HDD for double security.<br /><br />Its just the spaces in the filenames which prevents me from using this. I want to have the workflow well defined and fixed before I start using PSE5. <br />But it seems there is no workaround (so far).<br /><br />Maybe I should just take the "trouble" and rename every folder manually within PSE. No problem with one or 2 days, and still not a very big problem after a 3 week holiday. But still all single photo files will have the spaces in them. If I want to avoid that, I really have to bring them to the PC without PSE, rename them as batch with Irfan or any other tool, and then import them to PSE, as you wrote. From my point of view, a lot of unnecessary hassle, especially if I have the simple workflow from above in mind.<br /><br />Many people seem not to be disturbed by the spaces in the filenames. I wonder if I overrate the disadvantage of it. Your opinion(s)?<br /><br />I am not sure what you mean with<br /><Perhaps Ulrich would be well served if he created a collection of newly acquired pictures with a common theme.><br /><br />In fact I want to come away from theme centered archiving the photos, which is what I did so far. I learned this from the article <br />http://forums.dpreview.com/forums/read.asp?forum=1018&message=26366116 <br />and the following one from Arrowman. I won't follow all what he wrote *in detail*, but most ideas seem to be good. The PSE tagging should do the theme-related searches.<br /><br />Greetings,<br />Ulrich

  • How does Jason's multipartrequest works in the case of space in the filenam

    How does Jason's multipartrequest works in the case of space in the filename or the directory where the file resides?

    Good question...

  • How to replace a character in a string with blank space.

    Hi,
    How to replace a character in a string with blank space.
    Note:
    I have to change string  CL_DS_1===========CM01 to CL_DS_1               CM01.
    i.e) I have to replace '=' with ' '.
    I have already tried with <b>REPLACE ALL OCCURRENCES OF '=' IN temp_fill_string WITH ' '</b>
    Its not working.

    Hi,
    Try with this..
    call method textedit- >replace_all
      exporting
        case_sensitive_mode = case_sensitive_mode
        replace_string = replace_string
        search_string = search_string
        whole_word_mode = whole_word_mode
      changing
        counter = counter
      exceptions
        error_cntl_call_method = 1
        invalid_parameter = 2.
    <b>Parameters</b>      <b> Description</b>    <b> Possible values</b>
    case_sensitive_mode    Upper-/lowercase       false Do not observe (default value)
                                                                       true  Observe
    replace_string                Text to replace the 
                                         occurrences of
                                         SEARCH_STRING
    search_string                 Text to be replaced
    whole_word_mode          Only replace whole words   false Find whole words and                                                                               
    parts of words (default                                                                               
    value)
                                                                               true  Only find whole words
    counter                         Return value specifying how
                                        many times the search string
                                        was replaced
    Regards,
      Jayaram...

  • Why FileUtils::CopyFile doesn't work with blank space?

    Hi all,
    If I have a destination directory with blank space inside, looks like: "C:\Users\Pattrick James\Documents" for Windows or "Macintosh HD:Users:Pattrick James:Documents" for Mac.
    Then I want to copy a file to that directory, use FileUtils::CopyFile(src, des). Why it doesn't work?
    Can someone please help me to resolve this issue without change my path?

    Sorry, it works fine. It happens because the permission of the directory.

  • How do I get rid of the blank space at the bottom of the new Firefox menu?

    The new firefox 4 has a different menu system. IT has blank space at the bottom wiht just a plus sign that opens new tabs. I can get that from the + sign by the tabs and don't want it or the rest of the blank space on the bar. I need all the space in the main window I can get. How do I get rid of this?
    Found my own answer, disable Conduit Engine toolbar, whatever the heck that is. Why it's enabled to start with is beyond me.

    Hi stephanie,
    These are unrelated questions/statements.
    Space before and space after a paragraph are controled in the Text Inspector, as you've found out.
    Pages will create a page break whenever there is no room for another line on the page. That break can come anywhere in a paragraph.
    You may be thinking of Widow and Orphan prevention, and the other Pagination controls, found under the More button in the Text Inspector. (If that's what you found, then thanks for the refresher! I hadn't been to that pane for awhile, and had forgotten the variety of pagination controls available.
    Regards,
    Barry

  • How to Remove Blank spaces in the text elements for a smartform

    Hi All,
    Can any one please help me out to remove the blank spaces in the text elements.
    We are printing Labels using the Zebra Printer and we have rotated the windows to 90 degrees.
    We are able to see out text and barcodes. But the issues is when we are printing the label. We are getting spaces in the Text and in the Text elements fields. I have tried to give &g_name(C)&. But it is not working even i worked with style sheet spaces no luck.
    Currently out text and fields are printing like this
    s h r i y a n
    material number
    1111  -001  -000
    They should print like
    shriyan
    1111-001-000
    According to the ZEBRA suggestions we are using the font helve.
    Plase help us it is very urgent.
    Reward point will be given.
    Thanks

    Hi,
    Just use Condense g_name inside the program lines.
    Just to see how it behaves put a hard breakpoint.
    Break Username. and check the condense statement.
    condense <your field> no-gaps.
    Create program lines ahead of printing. give the field you want to condense in the input and output parameters of the program lines.
    Use condense inside the program lines.
    Thanks,
    Vamshi.

  • Pass parameter with blank space for report ver 6

    Hi,
    I face a problem that i willing to pass the acno where it's value with blank space, for example ' 9' as parameter into my report, and assign it as v_acno. Inside the report query i add a where condition, acno >= :v_acno. When i run the report and pass acno without ' , it do not show any record. But when i run the report and pass acno with ' then able to show the records.
    for example the value i key in
    with ' = ' 9'
    without ' = 9
    So how i can solve it by pass the acno without ' but the record still able to show?
    thks
    Message was edited by:
    user569740
    Message was edited by:
    user569740

    Hi Nick,
    It occurs because an argument of the DTExec commands must be enclosed in quotation marks if it contains a space. From the dtexe (SSIS Tool): Syntax Rules section of the
    dtexec Utility (SSIS Tool) document, we can see:
    All options must start with a slash (/) or a minus sign (-). The options that are shown here start with a slash (/), but the minus sign (-) can be substituted.
    An argument must be enclosed in quotation marks if it contains a space. If the argument is not enclosed in quotation marks, the argument cannot contain white space.
    Doubled quotation marks within quoted strings represent escaped single quotation marks.
    Options and arguments are not case-sensitive, except for passwords.
    So, you need to make the value of the variable @QUERY_STRING within double quotes in the value of the variable @Cmd or remove the space within the @QUERY_STRING value.
    Regards,
    Mike Yin
    TechNet Community Support

  • Replacing # with blank space in Bex Analyser

    Hi All,
    Can any one help me out in replacing # values in Bex analyser with blank space.
    I tried with the macro:
    Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
    ' First Query in the workbook
    If queryID = "SAPBEXq0001" Then
    ' Selects the area where the report query is rendered
    resultArea.Select
    'Replace "" with 0
    Selection.Cells.Replace What:="", Replacement:="0", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=True
    End If
    End Sub
    Means I have include the macro to the Excel, but still it is not working.
    If this macro is the correct solution, then may be I am not using it properly(in the sense I'm not calling with proper syntax).
    Please provide me with the solutiuon to get rid of this problem.

    Hi,
    We are using BEX 7.0.
    I got a macro code which is working. The code is as follows.
    Dim resultArea As Range
    Set resultArea = varname(1)
    Dim c As Range
    For Each c In resultArea.Cells
    If c.Value = "#" Then c.Value = " "
    Next c
    This works fine but the problem is that this macro code should be added each and every time when the query is run.
    Can any one suggest me where the code can be added in Bex Analyzer itself, so that when the query is run the above macro runs along with it and removes the #.
    Thanks and Regards,
    Geetha.

  • Work with text with blank spaces, how separate text?

    Hi:
    I have a problem in abap programming, I hope you could help me.
    I have a txt file, with a code and its description. I have this file uploaded to a sap internal table, in same field of internal table are code and description.
    The problem is next:  I need only the code, not the description, but length of code is not constant, and it is separated from description for at least two blank spaces. The code contains also a blank.
    Do you know how I can take only the code until these two blanks spaces? Any abap function, any idea..?
    Thanks in advance for your help.

    Hi,
    You could use split. if you code always contain a blank space then you won't have any problem.
    data: a(30).
    data: b(10).
    data: c(10).
    data: d(10).
    a = 'XY ABCDEF  EFGHI'.
    SPLIT a at space into b c d.
    Regards,
    Nitin.

Maybe you are looking for

  • How to make flash content which resize according to the broswer window

    Hi gus, I am doing a presentation now...but the problem i am facing is cos of the size of the content....what i need is when the users resizes the brower window, the flash content should also resize to fit in the window without using scrollbars....u

  • Oracle Terminal, how can i simulate this setting into all client places

    Hi friends, i did setting at ORacle Terminal for ESC button to exit_form. it is ok working fine. i have his application installed into several client places, so, in all this places do i ahve to install Oracle terminal and change the key mappings or i

  • Deactivating pop ups

    Hi @ all! How can I deactivate the pop up, which apears when i open a pdf- document? Adobe reader show me some bubbles, one text is like this: "get all files easily open on all devices" Is there a possibility to turn off this bubbles? Thanks for your

  • NI_LimitMeasurement in multiple numeric limit test results ?

    Hi, I'm setting up a database where I will store my teststand results. I've seen that the default "multiple numeric limit test" stores as first result an entry with type_name = "Array of NI_Measurement[0..n]" (n being the number of values returned by

  • Set up mail server in 11.1.2.3

    Hi I am trying to set up mail server for a planning application 11.1.2.3.Under Administration > Application Settings > Advanced Settings > System Settings tab, I cannot find the Email server option. Where can i enter the details for email server in 1