Delete characters in file names

Hello

I need a help to rename some files. i.e. remove some characters from files.

for example. XX_5182179 _ETERNITY_25TH_MB_AB_XYX_abc .ttjs

for example. XX_4182229 _ETERNITY_21TH_MB_AB_XYX_abc .ttjs


as above, for example. I have a lot of files on a file in the office.

and I want just to keep text highlighted in blue only. and delete characters inbetween.  that is XX_51312179.ttjs.

I have this script... but not do nothing...

myDoc var = app.activeDocument;

var myPath = myDoc.filePath;

var myNEWName = (myDoc.name.replace (".indd",".ps"));

var myDc = new queue (myPath +"/"+ myNEWName); myDoc.save (myDc);

myDoc.saveACopy (myDc);

Please help me to achieve this...

Thank you very much

Try this

var myfilePath = File ("E:\\rename\\");

var myFileName = myfilePath.getFiles("*.*");

for (var i = 0; i)

{

myNEWName = (myFileName [i].name.replace (/ replaceText /, "Thibaut"));

myFileName [i] .rename (myFileName [i].name.split ("_") [0] + '_' + myFileName [i].name.split (_ "") [1] + '.ttjs');

}

Tags: InDesign

Similar Questions

  • Insert "illegal" characters in file name for label printing?

    Hey all (Happy New Year)

    I actually see people here who have helped me with this there is responsible for so many years (Hello 'x'). Sort of, I use this .js file for annotate aerial images before printing, and I know just enough about scripts to make changes to the basic layout as the need arises - so far. A new retentive mgr rather anal don't like the replacements I did for some "illegal" characters that windows does not allow in file names. For example, the file name used for the annotation is:

    001 0003 1in = 660ft CFL 154_074 01-01014 503 - 013.tif

    But Mr. Bishop love not in, the ft and the use of the _ instead of a period (.), so what I need is a change that goes something like (and note that I DO NOT code, so stop laughing).

    "Find and replace by", find ft and replace by "and search for _ and replace by," so the final annotation written in the image is: ""

    001 0003 1 "= 660' CFL 154,074 01-01014 503 - 013.tif"

    My current .js is lower, I'd appreciate any help. Thank you! TLL

    ------------

    CREATE NEW CANVAS W/SPACE ON TOP

    var deltaW = 0; Add a "n" pixels to the width

    deltaH var = 150; Add "n" pixels to the height

    var anchor = AnchorPosition.BOTTOMCENTER; anchor point to resize canvas

    SET the FONT TYPE AND SIZE - use GetFontName.js to get the exact name

    fontName = 'ArialMT '; var

    var fontSize = 18;

    Check if a document is open

    If (documents.length > 0) {}

    var originalRulerUnits = preferences.rulerUnits;

    preferences.rulerUnits = Units.PIXELS;

    try {}

    var docRef = activeDocument;

    docRef.resizeCanvas (docRef.width + deltaW, docRef.height + deltaH, anchor);

    Create a layer of text on the front

    var myLayerRef = docRef.artLayers.add ();

    myLayerRef.kind = LayerKind.TEXT;

    myLayerRef.name = "Filename";

    var myTextRef = myLayerRef.textItem;

    ADD the FILE EXTENSION, change the n y below

    var ShowExtension = "n";

    myTextRef.size = fontSize;

    myTextRef.font = fontName;

    COLOR of the TEXT PUT in RGB values

    newColor var = new SolidColor();

    newColor.rgb.red = 0;

    newColor.rgb.green = 0;

    newColor.rgb.blue = 0;

    myTextRef.color = newColor;

    SET TEXT POSITION - PIXELS left first, then the top.

    myTextRef.position = new Array (30 110);

    Set the blending Mode of the text layer. The name must be in UPPERCASE

    That is to say NORMAL change to the DIFFERENCE.

    myLayerRef.blendMode = BlendMode.NORMAL;

    Select opacity in percent

    myLayerRef.opacity = 100;

    The following code deletes the extension and wrote tha text layer.

    fname = filename only

    Use the extension if the value

    If (ShowExtension == 'y') {}

    fname = docRef.name;

    } else {}

    di = (DocRef.Name). IndexOf(".");

    fname = (docRef.name) .substr (0, di);

    }

    myTextRef.contents = fname;

    docRef.flatten ("n");

    } catch (e) {}

    An error has occurred. Restore units of the rule, and then spread the error return

    to the user

    preferences.rulerUnits = originalRulerUnits;

    throw e;

    }

    Everything went well. Restore units of the rule

    preferences.rulerUnits = originalRulerUnits;

    } else {}

    Alert ("you must have a document open to add the file name! ');

    }

    Here is the replacement code:

    The following code deletes the extension and wrote tha text layer.
    fname = filename only
                   
    fname = docRef.name;
    fname = fname.replace(/in/, ' "') .replace (/ pi /, ' '"); "

    remove the extension if needed
    If (ShowExtension! = 'y') {}
    fname = fname.match (/ [^.] + /) [0];
    }

    fname = fname.replace (/ _ /, '.');

    myTextRef.contents = fname;

    I sent the entire file by PM. This should work if there aren't any typos.

  • Try to delete a pdf file name

    I'm trying to remove a deleted from my list of files to Adobe Reader pdf file name.

    This can be completely stupid, but can't you open just enough other PDF files to make its name drop down to the bottom of the list?

  • How to display Korean characters in file names?

    I received a number of files whose names were originally in Korean characters.   But when I watch it on my computer, the characters are jibberish.
    I tried the locale and language, but those who do not seem to address.

    I have Vista Home Premium.

    Thank you

    Hello Drew Park,

    Thank you for visiting the website of Microsoft Windows Vista Community.

    Try the rest of the stage in this article:

    To install the Korean IME on Windows Vista, start by opening the control panel.

    Click the Start button and choose Control Panel, then click on the option "clock, language, and regional.

    You should then see the regional and Language Options option, as shown below. Under regional and Language Options point select Change keyboards or other input methods.

    Who will bring up the keyboard and languages tab in the regional and Language Options dialog. Click Change keyboards... button:

    In the "text Services" and input languages dialog box, add the Korean IME and Korean keyboard components.

    Click on the button "Add..." ».

    You should now see the dialog "add an input language.

    Scroll to the Korean script, expand it and make sure that the Korean and the Microsoft IME selected items as shown below:

    Finally, click on the OK"" button.

    You should end up with a "Korean" entry under "installed Services".

    Finally, click on the OK"" button.

    You may need to put your CD of Windows Vista in the CD player, so that the files can be copied anywhere on your hard drive. NOTE: You cannot install the IME without the CD (please do not email me to ask..!).

    That's all. You should now see the IME icon in your taskbar which has a Korean option when clicked... like this:

    How to use the Korean IME?

    Once you have select KO (Korean) in the menu of EMI the task bar task bar,

    If you have selected Korean IME as above and you do a right click on the KO will show you the Options Menu:

    Choose the language bar option restore will convert the EMI in a floating toolbar with all visible IME options:

    Click on the GA Han / Eng will allow you to switch between hangul and English input Modes:

    TIP: The shortcut key to switch between mode is the right ALT key.

    Other options of the EMI and be displayed by clicking on the small arrow to the right of the floating IME toolbar.

    If you click on the element software keyboard soft keyboard icon will appear in the floating toolbar cela this:

    If it's a click on a Korean/Hangul software floating keyboard will appear:

    And the other option is the IME Pad, which includes handwriting recognition:

    With the handwriting recognition you can draw just the hangul Word, you want to insert, and then select the correct hangul in the choice of the right.

    Let us know if these steps solve your problem.  I hope the information is useful.

    Kind regards

    Anthony
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • AppleScript to the batch change file names

    I got the following script to a Mac user previous on this forum that works very well for a folder of files, but it does not work for a folder of files. How can I modify this script to work on files instead of files. What the script does is strip leading or the characters of files contained in a specified folder.

    Set Folder choose a folder

    Set theResult to display dialog "delete characters in the name:" buttons {"Cancel", "End", "Beginning"} default 0 Cancel button "Cancel".

    BTN set to the button returned of theResult

    Set text returned by theResult nCharacters as integer

    If btn = 'End', then the value of nCharacters - nCharacters

    Tell application "Finder".

    Repeat with thisFile (document get in Folder files)

    theFullName thisFile name value

    Set {oldTID, delimiters of point for the AppleScript text} to {AppleScript point text delimiters "."}

    If (number of items in theFullName text) > 1 then

    the properName my ((texte Articles 1 thru-2 dele de theFullName) text pad value, nCharacters)

    the revisedName value to (properName (get last element of theFullName text) {}) as text

    on the other

    the value revisedName my trim (theFullName, nCharacters)

    end if

    the text value of the AppleScript point oldTID delimiters

    revisedName thisFile name value

    end repeat

    tell the end

    on the trim (t, n)

    If n > 0 then

    Returns the text (n + 1)-1 through t

    on the other

    Returns the text 1 to (n - 1) t

    end if

    end trim

    Replace the line immediately after the tell one with:

    Repeat with thisFile in (get files Folder)

    (137177)

  • How do you keep Windows automatically passing the entire file name when editing?

    When I copy a file to a folder and rename the file, that I right click once on the file name to select it and again to place the cursor where I want to change the name in the name of the original file.  However, until I'm able to start typing the computer automatically highlights the entire file name, so that when I start typing deletes the original file name and replace it with what I typed.  Is there a way to avoid this and allow me to change the name of original rather than delete it and start from scratch?

    If I press ESC to restore the original name and follow the same steps again, that it allows me to change the name of the original file as you wish.  That is to say, I see only this product the first time I try to change the file name.

    After he highlights the entire name, press any cursor movement: home, end, left arrow, right arrow key.  Who will be development of the United Nations name and allow you to move the cursor in the right place to start to edit. Boulder computer Maven
    Most Microsoft Valuable Professional

  • Impossible to delete the two files and shows me the error message windows does not properly

    Hello

    can't delete two files that actually a song file VLC webrib exdr video...
    cannot select the option to delete the time I click file tht it shows me the message "windows doesn't work maybe not properly" and the file stops immediately once that I close this error message... Please give me a solution to this

    Hi MakPatel,

    You can delete these files via the command prompt, if your window closes...

    (1) open the command prompt. (Click the Startbutton .) In the search box, type command, and then prompt in the list of results, double-click command prompt. )

    2) navigate to the download folder where the video file is present, using the "cd"command.

    For example, if your file is present in the "C:\Users\user1\Downloads".

    Type cd C:\Users\user1\Downloads and press enter in the command prompt.

    (3) Delete (Remove) the file name using the "del" command.

    For example, if your video file name is "sample.mp4.

    Led sample.mp4 type and press enter in the command prompt.

  • It is not possible to delete files with characters draw in file names.

    If you copy this file name:

    MyPrefs␀␀

    And paste as the name of a file on your computer to El Capitan you not be able to remove it.

    If your computer cannot start in an earlier version of Mac OS X the only option I found was to format the drive and reinstall from upward (without restoring the file of course)

    If you're like me and have more than 10 TB of data, this can be something of a pain in the anus.

    For now, I resorted to a file of copies of each disc in the trash, move the offending in its respective folder file and returning the file via this folder to his house by car. I then turn the invisible folder so I don't have to deal with errors of garbage every time I remove a file.

    Until any of you tell me to use a terminal command, boot from a USB key, or use the restore mode. Try it yourself and failure.

    I put a little effort in an installation of linux thumbdrive I read on, but could not find one that was compatible with the new processor of skylake, but it worked fine on my old mac pro

    This was not the case in previous versions of the operating system.

    Non-alphabetic and non-numeric symbols are not recommend for naming files.

    https://support.Apple.com/en-us/HT202808

    Why would you use?

  • Impossible to rename/delete/file stubborn (long file name)

    I have a file (that I could rename 'Test') that contains 2 files. A file 'XXX.html' and his 'XXX_files' file with a long name (about 20 words). No matter how hard I try, I'm not able to delete the folder, or the 'Test' that contain.

    In addition, the XXX_files folder is not accessible when I try to open it (error "syntax is incorrect").
    The funny part is that I am not able to rename one of them with a shorter name. When I try to do, I get a message saying that the specified file name is too long!

    I tried the following methods:
    1. "Del" key
    2. "Shift" + "Del" key
    3. "File shredder", a 3rd party software
    4. "7 zip", a different 3rd party software
    5. Command: rmdir /s q, DEL command (for the folder that contains these 2 files) after the end of the Explorer
    Please help me!

    I fell on the same topic, like bradex:

    Had a file in Ubuntu with illegal characters (': 'and' \'): it cannot be renamed, and even from dir /x could not generate its short name. Google brought me here so I later on found this proposal for a solution and this worked for me. :)
    I hope this helps someone who comes here and also has the same problem.
  • Create these special characters in the name of the file as test.? docx or test? PDF in the OS window

    Hello

    Is there a possible way to create these special characters in the name of the file as test.? docx or test? PDF to test the goal?

    I do programming to detect this type of special characters in the file name. This modified script will this type of invalid char file appropriate name, so I need to have the sample to check if my script works.

    I have OSX or Linux. Is there no workaround solution I created in the window itself?

    or can someone create for me so I can go and download instead?

    Thank you and best regards,
    back4more

    Hi Backformore,

    Thanks for posting your question in the Microsoft answers Forum. For any question concerning the development of programs, visit the MSDN hereforums.

  • File name includes one or more invalid characters.

    'File name includes one or more invalid characters.

    Looks like maybe a bug if the photos are not taken with the cam of the Atrix.

    FYI - https://supportforums.motorola.com/message/352799#352799

  • The file names changed in wingdings, including the file extension and I can't delete, change them, open, etc. Here are the pictures.

    Have (had) a file with multiple files it contains with pictures in each file.  A week ago the pictures were there.  Now, the names are replaced by wingdings as names and file extensions.  When I try to open it, it is not accessible and that the file name, directory name or volume label syntax is incorrect.  When I try to delete it, it says that the file name you specified is invalid or too long and specify a different name.  When I try to rename it, it tells me that if I change the file name extension, the file may become unusable.  If I try to change anyway, it says I've specified file name is not valid or too long.  Only tried for the name 1.  I did a restore in the case where a program interfered with that.  However, nothing has changed.  All of the suggestions.

    You can download and try to delete the file Unlocker http://www.softpedia.com/get/System/System-Miscellaneous/Unlocker.shtmlwilh.  Although it is not designed for this particular circumstance, it may very well work in all cases, as it has been very successful in a wide variety of situations are not specifically highlighted in the directions (where do not work the normal Vista options).  NOTE: Some antivirus flag programs this program as a malware, but it is a 'false positive' and is safe to use perferctly.  My own software to flag, but several other well-known software products it clean and the warning is included in the documentation of the program.

    I wish there was a way to save the images, but at this point, it seems that the only option is to delete because you can't rename files EHF (if this option is available-I hope that work above).  Unfortunately, System Restore does not affect the files of data, so even if a program caused this, System Restore can eliminate the cause, but it would not restore the files to their previous names.

    If you have Vista Business, Vista Ultimate or Vista Enterprise, you can be lucky because they retain the files called snapshots http://windows.microsoft.com/en-AU/windows-vista/Previous-versions-of-files-frequently-asked-questions.  It can be used to recover previous versions of files that have been changed or deleted accidentally.  Here's how: http://www.microsoft.com/windows/windows-vista/features/shadow-copy.aspx.

    If you have Vista Basic or Premium of Vista, you don't have a shadow, but there is a free program for you that does essentially the same thing called Shadow Explorer: http://www.shadowexplorer.com/.  I suggest that you download and implement as soon as POSSIBLE to protect you if you accidentally delete or modify a file.  It will not help you in this instance, but it can help save the next time.

    I'm more concerned about why this has happened in the first place and prevent it from happening again.  I saw file names change before, but never of wingdings which then do not let you open, edit, delete, or rename.  We will check some of your system files: go to start / all programs / accessories / command prompt and right click on command prompt, and then click Run as administrator.

    Type sfc/scannow, go and let it run.  It will scan and try to correct some of your system files.  If all goes well he comes complete with no corruption, it could not repair (if it has these post of corruption here or try to analyze it to find the problem or files using http://support.microsoft.com/kb/928228.  If you find any these corrupted files, try to post them here.  Maybe we can replace the good files on the disc.

    While in the command prompt, type chkdsk /f /r and enter and let it run.  It will scan and try to solve any corruption or bad sectors on your hard drive and remove especially as a cause.

    If this does not work, then please post repetitive errors in Event Viewer about the name change (Start / Control Panel / administrative tools / Event Viewer).  Here's how to use Event Viewer: http://www.bleepingcomputer.com/forums/topic40108.html.

    If this does not work, you will need to do a repair/system upgrade using the Windows Vista Installation disc authentic (you own or that you can borrow from someone).  Here is the procedure: http://www.vistax64.com/tutorials/88236-repair-install-vista.html as well as the upgrade from an earlier version of the Windows section of the following: http://support.microsoft.com/kb/918884.  Although this will not affect your data, settings or programs, you should always back up your data before you start just be on the safe side. If other procedures do not work, it is almost certain to work - but it will probably not fix your renamed files.  You can have a lot of updates to re - install (including all you need to remove service packs).  If the version on system with SP1 or SP2 preinstalled cane and the disc is an earlier version, then you will need to do a slipstream drive as follows: http://www.vistax64.com/tutorials/151606-vista-sp1-slipstream-installation-dvd.html.

    I hope one of these procedures can solve your problem.  If this isn't the case, after return and we will try something else.  Return message anyway so we know how it turns out.

    Good luck!

    Lorien - a - MCSE/MCSA/network + / A +.

  • Microsoft, I am unable to delete a file, the file name isSHREDDER

    • I'm unable to delete a file, the file name is DESTROYER.
    • u tell me what to do.

    What is a 'file' or a shortcut? You have not given information about the nature of this "Shredder" "file."

    Did you do one search for others this problem? Here is a link.

    http://www.computing.NET/answers/Windows-Vista/i-cant-removed-Shredder-icon-on-destop/5799.html

  • Windows 7: delete the file - the specified file name is not valid or too long

    Hi I'm trying to delete some files in vain.  I have two types of error messages.

    (1) could not find this file. It is no longer in C:\Users\...
    Check the location and try again.

    (2) the name that you specified is invalid or too long. Specify a different file name.

    There are 7 files in total.  All these files are left by an old Ubuntu experience.   Some of the files were zero kb, but most are non-zero(but small).  Five files are I think printer drivers that end in .Act.  The other two files are in different directories (no KB file) and are called the same thing, "template.desc."

    I tried to go through the forums, but I couldn't understand it.  Thanks in advance to anyone who can help you.

    Andy

    The only way to remove it is the old way of BACK. Seems the info NTFS, files are broken, but the BACK is always very good.

    I had them and it worked:
    1) open to the high command prompt (CMD)
    Type cd 2) then the location of the file (in my case
    c:\users\james\desktop)
    type dir/x 3)
    (4) next to the file to delete, it will tell the 8.3 file name
    (e.g. HEDI ~ 1).
    (5) type del then 8.3 file name (e.g. HEDI ~ 1).

  • I have deleted the content of several image files and now want to remove the file names. I don't find a way to remove the names.

    * Original title: file names of photos of Deletig Windows after emptying the file

    I have deleted the content of several image files and now want to remove the file names. I don't find a way to remove the names. How can I delete the file names?

    Right-click on the name of the image file, then choose 'delete '.

Maybe you are looking for