Strip file name until character

Hi all,
i have a bunch of files (>> 100) which i would like to batch rename.
Every file starts with a random sequence followed by the character "-", filename.jpg
e.g.
45sdfm4rf-holiday01.jpg
dfgfdlfkssdfqwe-garden01.jpg
the result should be
holiday01.jpg
garden01.jpg
any ideas? i tried a loop with sed but i couldn't get it managed to rename the files probably.
thanks in advance!

broken pipe wrote:
thank you guys!
for file in *; do mv $file ${file#*-}; done
did the trick! so much easier than i thought! :>
Just a note, # will match and remove the shortest match (eg asfadsf-text-file.txt -> text-file.txt) if you want the longest, use ## (dfsaf-adsf-textfile.txt -> textfile.txt).
I used to forget that stuff all the time. The/A bash guide is well worth a peruse, even if it's just to get an idea that these things are in it.
Incidentally, I'd save that as a commented script file for future use (if you feel energetic, you could do stuff like add in the delimiter as a parameter, etc.). I'd make WorMzy's caveat prominent in it, too.
Oh and, please mark the thread as solved.

Similar Messages

  • File name limit/character case

    Good morning to all! Is there truly a 25 character FILE name
    limit for RH? I've been advised by Adobe that there is...but this
    is truly news to me after 10 years of working with RH. Its very
    painful to fit names into that limit when you have over 1000 topics
    in a project! But I renamed everything...carefully using
    MixedCharacterCase to try to establish order. Saving often! But
    then when I had to reimport files after rebuilding the .cpd file
    the MixedCharacterCase had turned to mixedcharactercase for many
    files. Ugh! Truly unreadable!
    So...is 25 characters truly a requirement? And...how to you
    force RH to remember the MixedCharacterCase for the File name?
    Help!...and THANK YOU!!!!

    Hi Peter. Yes you did. But since I called Adobe and asked for
    help and they SWORE that the 25 character limit was in fact law...I
    decided I needed to try it to make sure it was not the solution I
    was seeking. If I say No to their suggestions...I'm concerned that
    they will tell me that they can't help me...and I absolutely,
    positively need help with this project. 4-8 minutes to save a
    single image name, 5+ minutes to import a simply HTML
    file...ugh...life is miserable. So...I gave this a try.
    But when I rebuilt the .cpd file using the .hhk file and it
    lost 90% of the project even with those cute unreadable short file
    names I knew I was in trouble. So I decided to ask this group
    formally if 25 was really the limit, get the concensus and then
    respectfully ask Adobe to rethink this 'solution'. I'm in the 24
    response time window with them now. This is just no longer much fun
    for this project and its business critical. You know it well...
    I was not doubting your first answer...I was grasping at
    straws and now I need to be able to quote this group that they have
    an error in their Technical documentation.
    What Fun - not!!!

  • File Name from Character through hard return. Almost there.

    Hi all! I have a script that is naming my files by the characters in two text frames.
    It works... to a point.
    For some reason it is duplicating the name.
    This is the final result. > test-2-wealth-file-stuff,2-wealth-file-+-stuff.jpg
    when it should be this. > test-2-wealth-file-stuff.jpg
    for some reason it is adding > ,2-wealth-file-+-stuff
    any idea why? Thanks in advance.
    main ();
    function main() {
    var curDoc = app.activeDocument;
    // loop through all pages
    for ( var i = 0; i < curDoc.pages.length; i++ ) {
        // the current page
        var curPage = curDoc.pages[i];
        var pName = curPage.name;
        // controls the loop
        var controller = true;
        // all paragraphs on the current page
      var allPages = (curPage.textFrames.everyItem().paragraphs[0]); {
    pageName=allPages.characters.itemByRange(0,allPages.contents.toString().indexOf("^p") -1);
      var paraName = "" + pageName.contents;
    var paraString = "-" + paraName.replace( /\s+$/ , "" ).replace( /\s+/g , "-" ).toLowerCase().replace('+', '');
    var folderPath = "~/-client/" ;
            var appendix = paraString;
        var filePath = folderPath + "/" + curDoc.name.replace(/\.indd$/,"") + appendix + ".jpg";
        var myFile = File( filePath );
        with ( app.jpegExportPreferences) {
            jpegQuality = JPEGOptionsQuality.MAXIMUM; // low medium high maximum
            exportResolution = 72;
            jpegExportRange = ExportRangeOrAllPages.exportRange;
            pageString = pName;
        curDoc.exportFile( ExportFormat.jpg, myFile, false );
      } // end for > pages
    } // end for > main

    Hello cathykka,
    sorry, if I misunderstood your post.
    Quick & dirty
    You could replace these lines:
    // all paragraphs on the current page
    var allPages = (curPage.textFrames.everyItem().paragraphs[0]); {
        pageName=allPages.characters.itemByRange(0,allPages.contents.toString().indexOf("^p") -1);
        var paraName = "" + pageName.contents;
    with this:
    // all paragraphs on the current page
    var allPages = (curPage.textFrames[0].lines[0]); {
        var paraName = allPages.contents;
    There are some other things to do, but at first this should help.
    If not, please upload an example idml.
    Have fun

  • Error SP2-0333: Illegal Spool File Name: (bad character: ' ')

    Below is my spool file logic just to test outputting to a spool file with a date in the spool file. The date part works fine. I can see the date coming out in the error message. It doesn't like the spaces, but I am not in control of the folder names. Any ideas? I have tried putting single and double quotes around it to no avail. I also tried using the concatenation operator || to separate the path from the filename and that didn't work, either.
    col sdate new_value sysdt
    select to_char(sysdate,'YYYY-MM-DD') sdate from dual;
    SPOOL \\Nsgnvl_files\rco\Linecost Audit\General NA Info\CLLI_Code_Discrepancy_Reports\&sysdt.SendToLCAnotInRepository.txt
    SELECT TO_CHAR(sysdate) from dual;
    spool off

    Example :
    SQL> set escape |
    SQL> spool "c:\test| dir\foo"
    SQL> select sysdate from dual;
    SYSDATE
    2007-09-27 16:31:30
    SQL> spool off
    SQL> exit
    Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Prod
    ction
    C:\>cd test dir
    C:\test dir>type foo.lst
    SQL> select sysdate from dual;
    SYSDATE
    2007-09-27 16:31:30
    SQL> spool off
    C:\test dir>Message was edited by:
    Paul M.
    but I am not in control of the folder namesSorry, I didn't read carefully.....

  • Is it possible to call a report whith Ñ character in it's file name

    Hi,
    We have a customer which is having problem when calling a report when the file name has Ñ character, for example: reportedeañonuevo.rdf
    when invoking the report it gets the following error:
    REP-110: File reportede¿. cannot be opened
    REP-1070: An error occurred while opening or saving a document
    REP-0110: File reportede¿. cannot be opened
    The customer has reports 11g 11.1.1.6 64bits
    Regards
    Carlos

    calling a report with Ñ character in it's file name is not possible ?I didn't say that. I just said: try B-) I have no environment to try it myself right now.
    Furthermore: how are you calling your report? Directly via URL, or via Forms run_report_object?
    It is a very usual situation that you have to escape special characters in a URL. So yes, that is normal.

  • "not a valid short file name" and "invalid character" install errors

    Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software products that may be mentioned in the topic below. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information below at your own discretion.
    Symptoms
    While upgrading or uninstalling a Windows software application (such as iTunes for Windows or QuickTime for Windows), you may receive one of the following error messages:
    file name is not a valid short file name
    The folder path 'folder name' contains an invalid character.
    ... where file name could be the name of any file, and folder name could be the name of any folder.
    In the case of software that uses advertised shortcuts (such as recent versions of iTunes for Windows or Safari for Windows), the messages may also appear when attempting to launch software that has already been installed.
    Resolution
    The error messages are usually caused by damage to the installation database for the application. Clearing the installation database for the application by using the Windows Installer CleanUp utility can usually get you past the error message.
    (1) Click [here|http://support.microsoft.com/kb/290301] first, and read the important information about the utility.
    (2) Click the *Download the Windows Installer Cleanup Utility package now* link on that page to download a file titled msicuu2.exe.
    (3) Open the msicuu2.exe file and follow the prompts to install it.
    (4) 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.
    (5) Select the software you're getting the "not a valid short file name" or "invalid character" message for from the list and click Remove.
    (6) Click OK in the confirmation dialog that appears.
    (7) If you have multiple entries for the software you're getting the "not a valid short file name" or "invalid character" message for, repeat steps 5 and 6 for the other entries for the software.
    (8) Click Exit.
    (9) Restart the computer.
    If you were getting the "not a valid short file name" or "invalid character" message when trying to upgrade or launch software, now try reinstalling the latest version of the software.
    If you were getting the "not a valid short file name" or "invalid character" message when just trying to uninstall software, program files for the software in question will remain on the PC after it has been removed by the Windows Installer CleanUp utility. If you want to remove leftover program files, check in at the appropriate forum at [Apple Discussions|http://discussions.apple.com/index.jspa?categoryID=1] and ask which files can be safely removed.
    This is the 1st version of this tip. It was submitted on March 24, 2010 by b noir.
    Do you want to provide feedback on this User Contributed Tip or contribute your own? If you have achieved Level 2 status, visit the User Tips Library Contributions forum for more information.

    Go to Microsoft website to fix installer file problems.
    Click "Run now" from Fix it to remove all iTunes & related installer files:
    http://support.microsoft.com/mats/Program_Install_and_Uninstall
    Be aware that Windows Installer CleanUp Utility will not remove the actual program from your computer. However, it will remove the installation files so that you can start the installation, upgrade, or uninstall over.
    Download and Install iTunes

  • 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

  • Read Document in FileUtilities  cannot search a file with french character in the file name

    Hi,
    I am trying to search a file with french character in the file name like 'captures écran.doc' in my unix server directory, and Write the file somewhere, say in a list of documents or, write on file system to another directory.
    I am using to Read Document in FileUtilities of Foundation, but it cannot read the file due to french character in its name. Although it can find any other file name without these french characters.
    Tried renaming but that also cannot find the file with french character name.
    Please provide any idea to solve it using LC operation.
    Regards,
    Rohan Raj.

    Hi Thomas,
    Thanks for the post, but I have already found a solution to it a month ago. Sorry for not posting the solution.
    You just have to set the '-Djava.property.file.encoding=ISO8859-1' into JVM argument of your server startup, and bounce the server back to pick the new JVM arg set. And now the service Read Document in FileUtilities of Foundation will read all french characters.
    ISO8859-1refers to "Latin alphabet no. 1," consisting of 191 characters from the Latin script. This character-encoding scheme is used throughout The Americas,Western Europe, Oceania, and much of Africa. It is also commonly used in most standard romanizations of East-Asian languages.
    regards,
    Rohan Raj.

  • How can I modify ONE CHARACTER in the file name???

    I have in right side meta tag panel a file name , original name and copy name fields.
    The file was already renamed. So i am not interested original file name ,anyway i cant click on it.
    I would like to modify ONE +"!/"%/"+! CHARACTER in filename field which is 50 characters long.
    If I click on it gives me an batch rename window.
    If I click copy name I have to write all from zero BECAUSE I CANT COPY the filename field.
    so here we are in 21st century
    I have a solution: i copy the filename from vista explorer and paste it in copy name BUT what if I have to do this hundreds time???

    First, what has the copy name to do with file name? I think you're misunderstanding the purpose of the copy name field. It is for giving a virtual copy a distinctive name.
    Now for file naming... if I understood correctly, you want to edit the name right in the Metadata panel, but the file name field is non-editable. This is a bug. It is exhibited when you have multiple files selected and change the metadata panel view. You can temporarily fix it by selecting a single file in the grid and changing the metadata panel view from All to Default or vice versa (see the attached screenshot). Now that the field became editable, you change on character.
    If you want to do it for hundreds of files using a template, then would be nice if you provide your source and target filename templates.

  • Some chinese character file name not uploading in SharePoint Document Library?

    Hi
    Some Chinese character pdf file name not uploading in SharePoint Document Library. I am getting following error.
    1. File not found error if i would upload using file browse option in Doc Lib.
    2. Can't read from the source file or disk. if i would tried to copy and paste using "Open with explorer" options.
    File name is "LA(未签署).pdf"
    Note: This file has been converted from "TIFF" to "PDF".
    Thanks & Regards
    Poomani Sankaran

    Hi Poomani,
    For troubleshooting your issue, please let's verify the followings:
    Whether other pdf file which are not converted from "TIFF" and contain Chinese char could be uploaded into the SharePoint Document library.
    Whether other pdf file which are converted from "TIFF" and don't contain Chinese char could be uploaded into the SharePoint Document library.
    Please upload these pdf files into other libraries, compare the result.
    Please check the log file to find more information about this issue. The path of the log file is:
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS.
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Remove Special Character "/" from file name

    I'm trying to upload a PDF located on my desktop to a server that won't accept special characters, and the mac path is by default ~/desktop/file ... all those forward slashes read as "special characters" and the file is rejected. I moved the file as high as I could, out of the user folder and onto the HD, but it still contains a "/" as the initial character even there.
    How do I get rid of the "/" at the beginning of the file name? Thanks...

    You can't; every location where a file can be placed on a disk available to Mac OS X contains a / in the path. Contact the server's operators or move the file to a computer running another OS.
    (42358)

  • Can I create action to Save As...  and change only one character of the original file name?

    I'm working on a group of  files(25-28) at a time. I have to save each one as a photoshop .raw file and change the first character of the file name. the rest of the file name must remain the same. I then close the original file with no changes. I tried to create an action for this. The only problem is that the next file overwrote the file I used to create the action.  Is it possible to creat an action to save as... and keep the file name of the new file but chage the first character to the same one used in the recording?

    Good day!
    I think what you are describing is not possible with Actions.
    Scripting would be an option, but more convenient might be simply saving the files with unchanged names and then edit the names of  the whole bunch in Bridge in one go (Tools > Batch Rename).
    Regards,
    Pfaffenbichler

  • How to strip a file name and add it to array

    Hello I am new to labview, and I need to know how to strip a file name and add it to an array. For example, filename joe.csv, then take "joe" and add it to an array with other inputs. A visual depiction will be very helpful
    Attachments:
    channel read and error check R03_v9(JHK).vi ‏101 KB

    What does your code attachment have to do with your question?
    What are "other inputs"?
    I assume you have an array of strings. You can strip the filename using get file extension. You can build an array using build array. Wire the existing array on one input ant the string as a second input.
    LabVIEW Champion . Do more with less code and in less time .

  • Why can't I import clips with foreign character file names?

    What the **** man?
    I've got a series of clips with foreign character file names that FCP will not let me access via the Import->File method. Some of the offending character sets include Chinese, Arabic, and a couple of less well known Unicode sets like Cherokee and Inuktitus.
    What's interesting is that I can easily drag the clips onto the TL manually via Finder, but not File->Import. Also, XML passed to FCP that includes foreign character file names is ignored. Seeing as FCP is an Apple product I would have expected proper Unicode support 4 years ago.
    Obviously I don't need a workaround per se... But I'd very much like to know why this is the way it is. We're developers doing development work for FCP so it's important for us.

    We're developers doing development work for FCP so it's important for us.
    Then you have a more direct path to the FCP engineers than this forum. Send them feedback directly. This place is user to user - no apple employees are officially here.
    good luck.
    x

  • File Name Character Limited to 31 - New or something I've done?

    I have been using my MacBook Air with Mavericks for ~6 months and just started getting file name size limit of 31 character warnings a few days ago.  I have many files saved with much longer file names but now cannot go over the 31 character limit.  Have I inadvertantly changed a setting or is this something new in a recent update?
    Bottom line - how do I get back to using longer fle names?
    MacBook Air, OS X Mountain Lion (10.8.4), MBA 11" Loaded (1.7G / 8G / 512G)

    call Apple Care - 800-275-2273
    But I doubt that you will get FaceBook support from Apple - I'd suggest calling FB support
    LN

Maybe you are looking for

  • About lock object

    I have one TABLE with TABLE MAINTENANCE GENERATOR  and it has also LOCK OBJECT. Now I have adjusted the table by making some normal fields as primary keys and regenerated Table  maintenance generator , It seems to me lock object also adjusted( I am a

  • Gallery activities are not tracking in my profile.

    I've added new gallery but its not reflected in my profile.I tried to unpublish and publish again. It din't help. http://gallery.technet.microsoft.com/PowerShell-System-571521d1 Please help -Prashanth

  • "Automatic Duck" give away their plugins for free.

    Grab these great Final Cut plugins for free now  : "Because we are so busy with these new projects we cannot provide the same level of support for our plug-ins that we used to, therefore we can't in good conscience charge money for them. But we don't

  • Password protect a gallery

    Is it possible to password protect a photo album or gallery on my iweb 08 site? Thanks, Mark

  • Memory allocation in SpeedGrade

    I've noticed that I get a ton of laggyness when using SpeedGrade after the memory hits its 3GB max. Is there a way to allocate more memory to the program to alleviate the problem?