Renaming a file you already have in file obejct?

Hi
I have a file I've already loaded into a var.
I've made a function that I want to rename the file on the hard drive using moveTo(), so that backup_ is added to the front of the file name:
myFile.nativePath;
renameMyFile(myFile);
public function renameMyFile(filePath:String)
            var original = File.documentsDirectory;
            original = original.resolvePath(filePath);
            var destination:File = File.documentsDirectory;
            destination =  destination.resolvePath("backup_"+filePath);
          original.addEventListener(Event.COMPLETE, fileMoveCompleteHandler);
            original.addEventListener(IOErrorEvent.IO_ERROR, fileMoveIOErrorEventHandler);
            original.moveToAsync(destination);
private function fileMoveCompleteHandler(event:Event):void {
                trace(event.target); // [object File]
private function fileMoveIOErrorEventHandler(event:IOErrorEvent):void {
                trace("I/O Error."); 
It keeps tracing "I/O Error."  The new file doesn't already exist, so the error isn't thrown due to it already being there.
What is the correct way to do this, if you already have the file's nativePath in a string?
Thanks guys.

You would be better off using a script to do this as an example as I don't think it would be possible in the Bridge re-name.
Using ExtendScript Toolkit or a Plain text editor copy the code into either and save it out as Filename.jsx
This needs to be saved into the correct folder. this is found by going to the preferences in Bridge, selecting Startup Scripts, this will open the folder where the script is to be saved.
Once this is done close and re-start Bridge.
To Use: Goto the Tools Menu and select Rename PDFs
Make sure you test the code with a few copied files into a seperate folder first to make sure it does what you want.
The script will do all PDF files in the selected folder.
#target bridge 
if( BridgeTalk.appName == "bridge" ) { 
renamePDFs = MenuElement.create("command", "Rename PDFs", "at the end of Tools");
renamePDFs.onSelect = function () {
app.document.deselectAll();
var thumbs = app.document.getSelection("pdf");
for( var z in thumbs){
var Name = decodeURI(thumbs[z].spec.name);
var parts = Name.toLowerCase().replace(/\s/g,'-').match(/(.*)(-)(.*)(-)(.*)(\.pdf)/);
var NewName = parts[1].replace(/^[a-z]/, function(s){ return s.toUpperCase() });
NewName += parts[2]+parts[3]+parts[4]+parts[5].toUpperCase().replace(/[A-Z]$/, function(s){ return s.toLowerCase() });
NewName += parts[6];
thumbs[z].spec.rename(NewName);

Similar Messages

  • You already have a schema opened on this file with another name: abc

    I am trying to create a model for an XML file, when I clicked on "Objects to Reverse" checkbox under "Selective Reverse" tab, I am getting the following error:
    java.sql.SQLException: You already have a schema opened on this file with another name: abc
    I have created a Data Server in Topology whose schema and workschema are "abc" and logicla schema is "Labc".
    Where is the mistake going in?

    That is because you can only connect to a file in read/write mode once at a time. When you connect to a file without specifying ro=true (e.g. Read Only=true) in the URL, the file is locked and you can’t connect to the file from another instance until the original connection is dropped. I assume since you are trying to connect to the file multiple times that you mean to connect in readonly mode. To do this, like I mentioned earlier, simply add ro=true to your URL and you should be all set. Note: you may need o restart your JVM for chnges to take effect. Let me know if that works.

  • Hello  J have problem in the demarage d iphoto the dialogue displays and asks me for the following text?  138 photos not having been imported were found in the iPhoto library(bookcase).  Would you care for import them? Yes or no you already have meet this

    onjour
    j ai des probleme au demarage d iphoto le dialogue s affiche et  me demande le  texte suivant ?
    138 photos n’ayant pas été importées ont été trouvées dans la bibliothèque iPhoto.
    Souhaitez-vous les importer ? oui  ou non avez vous deja rencontrer ce proble  si oui pouvez vous m aider
    Merci
    Hello
    J have problem in the demarage d iphoto the dialogue displays and asks me for the following text?
    138 photos not having been imported were found in the iPhoto library(bookcase).
    Would you care for import them? Yes or no you already have meet this prowheat if yes can you m help
    Thank you

    Open your iPhoto Library package with the Finder as shown in this screenshot
    and look in the folder named Auto Import.  Move any files in that folder to a folder on the Desktop and close the package. Do not make any other changes.  Launch iPhoto (the message should be gone) and drag the folder on the Dersktop into the open iPhoto window to import them.
    OT

  • Can you get a free download of the new Pages through the appstore if you already have an earlier version of iworks from a disk?

    I have loaded mountain lion on my iMac and have an old version of iWorks on my machine.  It appears that all my Pages documents won't open unless I get the new version of Pages off the App store.  Does anyone know if that is a free download if you already have purchased iWorks previously on disk?  Thanks.

    No. The iWork (no 's') apps are a separate purchase. You should not have to buy any of the '09 apps again to work in Mountain Lion, you just need to update them.
    iWork '09 installed from the retail disk or from the downloaded trial must be updated through Software Update. In Mountain Lion Software Update has been "rolled into" the Mac App Store. Choose Software Update from the Apple menu just like you always have & the Mac App Store will launch. Depending on what you have that needs updating you may see two sections in the MAS window.
    But, as always, if you're not running the latest versions of the iWork apps installed from a retail box or the downloaded trial & Software Update says your software is up to date, make sure the applications are where the installer initially put them. The updaters are very picky. If the location is not where the updater is programmed to look or if the folder doesn't have the name the updater looks for, it will not work. The applications cannot be renamed or moved. If you installed from the downloaded trial or the retail box, they must be in the iWork '09 folder in Applications. That iWork folder must be named iWork '09. If it doesn't have the '09 Software Update won't find them & the updaters won't work.
    Alternatively, you can download the standalone updater here.

  • I'm trying to change my ICloud e-mail to match the one associated with the Apple ID? Can someone tell me how to do this? Seems like the phone won't accept the new one, the message states "you already have acct associated....."  (a given!!)  I need help !!

    I'm trying to change my ICloud e-mail to match the one associated with the Apple ID? Can someone tell me how to do this? Seems like the phone won't accept the new one, the message states "you already have acct associated....."  (a given!!)  I need help !!

    You made a purchase and exhausted the credit on your card before it processed. All purchases are final. Contact iTunes Store support. You need to settle up before you can purchase or download anything else.

  • How can You create a rescue email if you already have an Apple ID/account?

    I didn't think about it, thought I didn't need it, but now I know. I forgot my security answers, and I keep getting locked. I need a way to create a rescue account if I already have an Apple ID/account. I won't click on any links unless it directs me to the exact location on creating a rescue email while you already have an Apple ID/account. I went through enough threads, links and everything, I've tried every single way to answer, but still keep getting locked out. Please help me, I need it.

    There is no way to create a rescue email address without correctly answering two of the questions. You need to ask Apple to reset them; ways of doing so include clicking here and picking a method for your country, and filling out and submitting this form.
    (95996)

  • Setup has detected you already have a more functional product installed....

    Ok, have adobe standard XI. end user needs Pro to redact sections of pdf's.
    paid 199.00 for digital upgrade from standard to pro. download...execute...
    error on starting setup. setup has detected you already have a more functional product installed....installation will now terminate.    
    I have 2 choices. the Go to hell adobe your product dont work, and process a refund.
    or
    try to get phone technical support.
    Honestly why does adobe make it so difficult to work with them. My company needs digital signatures and i'd never use adobe. Adobe support is the worst in the IT industry imo and apparently their software developers cant determine that Pro is and UPGRADE from standard.
    if anyone understands a work around i'd be interested in hearing but i can't say i've ever had an efficient experience with adobe and i wish i could find an alternative for adobe acrobat pro.

    First you are attempting to install Acrobat Pro XI over Acrobat Standard XI and it's throwing an error that you have a more capable product.  While not the most elegant or even correct message IMHO what it means is that you can't install the same version of Pro over Standard. If they were different versions (ie. Acrobat Pro XI over Acrobat Standard X ) then it would work.   There are good reasons for this installation error, but let us try to get you to the place where you can actually get the work that you need to get done accomplished. 
    You can use a virtual machine like VMWare, VirtualPC, Parallels, or Oracle VirtualBox to host another Windows instance and load Adobe Acrobat Pro on that vm.  These are really the best way to keep things on the same machine and have both as separate usable installations.  In all cases, you provide the Windows installation media. The price of the VM software varies from free to some reasonable prices.   Your choice though.
    VMWare is a purchased product Windows and Mac:  http://www.vmware.com
    Parallels is a purchased product for Mac only:  http://www.parallels.com
    VirtualPC is downloadable from Microsoft at no cost:  http://www.microsoft.com/en-us/download/details.aspx?id=3702
    Oracle VirtualBox is downloadable from Oracle at no cost: https://www.virtualbox.org
    And one more thing... you need to contact Adobe Customer service because you should be using the full Acrobat XI installer with a full blown installer Serial Numberand not the upgrade installer with an upgrade serial number.

  • If you already have a web host can you upload your site to BC so client can edit in browser

    If you already have a web host can you upload your site to BC so a client can edit in browser?

    If you already have a web host can you upload your site to BC so a client can edit in browser?

  • When trying to install Adobe Standard XI, it says, "Setup has detected that you already have a more functional product installed. Steup will now terminate."  I have a Pro trial installed but did not seed so much functionality so I purchased standard.

    When trying to install Adobe Standard XI, it says, "Setup has detected that you already have a more functional product installed. Steup will now terminate."  I have a Pro trial installed but did not seed so much functionality so I purchased standard.

    uninstall any acrobat and reader versions, if you have win os clean (Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs) and then install acrobat std.

  • HT3702 Has anyone else had itunes take the money for a purchase out of you bank account when you already have enough money as a credit on your itunes account?

    Has anyone else had itunes take money for a purchase out of your bank account when you already have a credit on your itunes account to cover it?

    acuna matata wrote:
    Dear Carolyn
    I tried to forward the email to [email protected] but it was rejected saying that that email address was not recognised. Please could you recheck and let me know
    Thankyou
    Acuna matata
    It should be [email protected] You left out a letter.

  • When I try to email a photo from my iphone it ask for my id and password then says you already have an account?

    When I try to email a photo from my iphone it ask for my id and password, then it says you already have an account?

    I figured out that I could use the message selection it gives and just type in my email address and it worked.  I dont know why the email selection never worked, it just kept asking me to enter id and password and then telling me I have an account?  I will be getting the newest phone so I can be rid of this ancient one: )

  • If you already have an iPod..Can you use an iPhone on the same computer?

    If you already have an iPod, can you use an iPhone on the same computer?

    Yes, you can sync as many iOS devices on one itunes as you like.
    Make sure to give them different names.

  • Video conferencing if you already have VoIP running

    Hi, imagine on a large organization you already have a voip system up and running.
    Then you decide to deploy a video conferencing system.
    In general, how much configuration do you expect to perform in order to deploy the video over IP successfully? Should I expect to do mainly client configuration in order to watch the video conferencing, or that is going to require router/switch configuration as well to accomodate the video traffic?

    It depends on the type and volume of video conferencing you're talking about. If you're referring to point to point conferencing using VT advantage, the configuration will be minimal. If you're referring to multipoint conferencing using a conference controller(s), the configuration becomes more complex. With any video, it's necessary to configure QoS throughout the network. This will certainly involve router/switch configuration in order to classify, mark, and honor the markings of video traffic.
    Hope this helps. If so, please rate the post.
    Brandon

  • How do you download apps that you already have on your itunes account on to your iphone 3gs, how do you download apps that you already have on your itunes account on to your iphone 3gs

    how do you download apps that you already have onto your i tunes account onto your iphone 3gs

    Sync them as you do wverything else.
    Open itunes, connect iphone, select what you want to sync, sync.
    iPhone User Guide (For iOS 5.0 Software)

  • If you already have i works will you have to buy a app or is is free

    If your mac has a program will you be charged for the App?

    If you already have a Application such as iWork installed on you computer, you do not need to install it again, simply keep using it as you always have.
    All the App Store is, is a new shop front where you can purchase new Apps when you want and as another part of it's service, it will notify you when there are updates available for those Apps.
    If the App Store does not pick up that you have something installed at the moment, will not stop the current install from working.
    Some Users have found that the App Store shows that iWork is installed on their machines and others have found that it doesn't pick up that it is installed. This may be because of the different ways or locations that the Applications have been installed on those computers or it could be an issue with the store software. Who knows at the moment.
    The thing to remember is that if you already had the App on your computer, you don't need to buy it again and Apple won't stop you from using the current install.

Maybe you are looking for

  • How do I get back my Before/After Icons?

    The icons for the before and after view have disappeared on my lower menu bar.  They were always displayed just above the thumbnails at the bottom of my screen, and now they are gone.  How do I get them back I appologize for this simple question in a

  • How to walk through an explain plan

    Hi Experts, I am on Oracle 11.2.0.2 on Linux, I have a query with an query plan as below. I am trying to understand the sequence in which the steps are executed, can you please help on it: variable v_client_oid varchar2(16); variable SYS_B_0 varchar2

  • Lov not doing mandatroy validation

    hi i have this lov it does not do required validation even if i set required =true ,am in jdeveloper 11.1.1.6.0,is not checking that validation <af:selectOneChoice value="#{bindings.Officecode.inputValue}"                                         labe

  • Incompatible VI server protocol

    Does anyone know if there is a incompatible issue between labVIEW 5.0 and 6i when using the VI server? I've configured my server on a machine running labVIEW 5.0 and get the following error when opening an application reference on a machine with 6i E

  • I would like to merge my mobile bookmarks with my desktop

    Hi. I lost my security password and username for my mobile device app of Firefox the one to sync bookmarks and I can't retrieve it. But I'm trying to pass all of my bookmarks to my desktop laptop and also merge both of them. Any help with this