Copy File, Delete File & Opening Document

Hi All
Please help, note that I use JDK 1.1.7A. I have 2 directories I recieve a file into the first. This kicks of a process, when the process is finished I must take the file and copy it to the 2nd directory. Once it is copied I have to delete it from the 1st directory.. I then check through my explore from windows to see if I can open the document after it had been copied. I get an error from Winword that kinda says the following:
Document Name or path is not valid. Try these sugestions. Check file permissions. Use OPen Dialog box[]
private boolean copyFiles(String sFrom, String sTo, String sCopyList)
File fFrom = new File(sFrom);
File fTo = new File(sTo);
String sParent = "";
if (sCopyList.equals("PCIError"))
  sParent = fFrom.getParent();
  fTo = null;
  fTo = new File(sParent, sCopyList);
int iNoToCopy = 0;
File fTempRead = new File(fFrom.getAbsolutePath(), sCopyList);
File fTempWrite = new File(fTo.getAbsolutePath(), sCopyList);
if (fFrom.canRead())
  try
   RandomAccessFile randomWrite = new RandomAccessFile(fTempWrite, "rw");
   RandomAccessFile randomRead = new RandomAccessFile(fTempRead, "rw");
   long fLength = 0l;
   if (fTempWrite.exists())
    fLength = fTempWrite.length();
    randomWrite.seek(fLength);
   //FileReader fRead = null;
   //String sRead = fFrom.getPath() + File.separator + sCopyList;
   //fRead = new FileReader(sRead);
   //BufferedReader bufRead = new BufferedReader(fRead);
   String s = null;
   while ((s = randomRead.readLine()) != null)
    randomWrite.writeBytes(s);
   //bufRead.close();
   randomRead.close();
   randomWrite.close();
   fTempRead.delete();
   File fDelete = new File(fFrom, sCopyList);
   fDelete.delete();
  catch (IOException ioE)
   ioE.printStackTrace();
   return false;
return true;

Hi All
I though that I had this problem resolved Alas I don't. If I have 2 existing directories than it works fine. When I have to create a new directory then I run into some problems. File creates a file. You then use the mkdir() method to make that file into a directory. It does not work the system creates the file but then doesn't turn it into a directory when that method is called.
Here is the code:
private boolean copyFiles(String sFrom, String sTo, String sCopyList)
     File fFrom = new File(sFrom);
     File fTo = null;
     String sParent = "";
     boolean bDir = false;
     if (sTo.endsWith("PCIError"))
          sParent = fFrom.getParent();
          fTo = new File(sParent);
          bDir = fTo.mkdir();
     int iNoToCopy = 0;
     File fTempRead = new File(fFrom.getAbsolutePath(), sCopyList);
     File fTempWrite = new File(sTo, sCopyList);
     if (fTempRead.canRead())
          try
                        //This is where the IOException is thrown
               RandomAccessFile randomWrite = new RandomAccessFile(fTempWrite, "rw");
               RandomAccessFile randomRead = new RandomAccessFile(fTempRead, "rw");
               long fLength = 0l;
               if (fTempWrite.exists())
                    fLength = fTempWrite.length();
                    randomWrite.seek(fLength);
               byte by[] = new byte[500];
               int byteread = 0;
               randomWrite.seek(0);
               while ((byteread = randomRead.read(by)) != -1)
                    randomWrite.write(by, 0, byteread);
               randomRead.close();
               randomWrite.close();
               fTempRead.delete();
               File fDelete = new File(fFrom, sCopyList);
               fDelete.delete();
          catch (IOException ioE)
               ioE.printStackTrace();
                        //what is printed out to my console:
                        /*java.io.IOException
                       java.lang.Throwable()
                          java.lang.Exception()
                       java.io.IOException()
                       void java.io.RandomAccessFile.open(java.lang.String, boolean)
                       java.io.RandomAccessFile(java.lang.String, java.lang.String)
                       java.io.RandomAccessFile(java.io.File, java.lang.String)
                       boolean pci.Pci.copyFiles(java.lang.String, java.lang.String, java.lang.String)
                       void pci.Pci.run()*/
               return false;
     return true;
RESULTS
I want to create in a directory PCIError as File folder in directory:
E:/Applications/.
Thus it must look like this:
E:/Applications/PCIError.
I want PCIError to be a File folder. But instead I get the following: E:/Applications/PCIError and PCIError is not a File folder but just a simple file that is not a directory at all so I can't copy any files into directory:
E:/Applications/PCIError
Because it isn't a directory but a file.
I would appreciate any help possible. Please also remember the version in which I have to write this program it is not an option to change the JDK Version.
Regards & thanx

Similar Messages

  • Please help. Javascript to open/place a file onto an open document to a specific layer

    Hello,
    I would like a javascript that would open and place a PDF file to an active document in Illustrator. I would like it to place it to a specific layer, align it to the art board, and then embed it. Can someone please help?
    Thanks in advance.

    This should be close to what you want:
    var sampleFile = new File( Folder.desktop.fullName + "/SampleFile.psd");
    if (sampleFile.exists) { app.open(sampleFile); }
    else { alert("Could not locate sample file on the desktop."); }
    Tested it out on a Windows machine with no problems.

  • Error Code-50 when trying to copy or delete files on external hard drive

    Hi,
    I am in process of backing up large HD video files from one external hard drive to another using Carbon Copy Cloner software.  I get this error message:  "This file or folder is sitting on a bad section of hard disk media and is unrecoverable. Delete this item (i.e. in the Finder) and restore it from a known good backup, then try the backup task again."
    I have tried to delete that folder in Finder and I get error code-50, it won't delete. 
    I tried to delete individual files within folder - error code 50.
    I tried to "replace" folder with good copy from other external hard drive.  Error code-50
    I tried to "repair disk" in Disk Utility application and I get error message "cannot unmount disk." 
    NOTE:  the files in this folder are .m2ts format, from an old PC.  I converted then into .mov but want to retain originals. 
    NOTE:  I was successfully able to copy the folder from a 3rd external hard drive to the backup disk without a problem (which makes me think it's not the files/folder but has to do with the actual disk.), but cannot fix it on the original (source) disk.
    Bad disk?
    Bad files?
    How do you fix a "bad section of a hard disk"? 
    Might reformatting the entire disk fix the "bad section"?
    Any advice welcomed and appreciated!
    Thank you!

    Hi
    Error -50 paramErr  Error in user parameter list
    Can there be any external hard disks - if so How is/are it/they formatted ? Must be Mac OS Extended (hfs) if used for Video.
    UNIX/DOS/FAT32/Mac OS Exchange - works for most but not for VIDEO.
    What this means in Your situation is above me.
    • free space on internal boot hard disk? How much ?
    Video codec
    • streamingDV, AIC etc. (not .avi, .mp4, .m4v, .wmv etc as they are containers not codecs)
    Pictures
    • in what format ? .jpg, .bmp, .tif, else ?
    Audio
    • from where/what format ? iTunes, .avi, .mp3, .aiff, else ?
    The "com.apple.iMovie.plist" file
    Many users has not observed that there are TWO libraries.
    • Library - at root level
    • Library - in user/account folder - THIS IS THE ONE to look into
    from Luke Burns
    I fixed the problem.. but it was very, very strange. I had a very long section for credits and set the line spacing to 1.0.. for some reason this caused it. I removed it, and it worked fine. I put it back, and I couldn't preview or play the video.
    I don't know why that could cause that big of a problem, but it did..
    Klaus1
    You need more free space on your hard drive.
    jonorparkerjon
    After phone support from apple I ended up creating a new project and adding all 117 clips back in individually till I found out what clips flagged and would not allow me to export. I had 3 I deleted and replaced and everything works now 1hr after tedious work....
    Where do Your material come from
    • Camera
    • External hard disk
    • USB-memory
    And all are connected so that iMovie can find it ?
    Yours Bengt W

  • TechTool Pro copying large "deleted" files when I Time Machine my computer

    I have TechTool Pro 5 loaded on my MacBook Pro. I've noticed when I Time Machine the computer, about 4 gig is always (or seems to be) copied over to the time machine drive in files named "Trash Deletes". It puts them in my Application Support folder in my library.
    Is this TechTool backing up my emptying the trash - if so, it sure is taking up a lot of space o the time machine drive? Hopefully, I'm wrong here. I use "Timetracker" to see what files are being backed up thru Time Machine.
    Anyone else out there notice this?
    Thanks,
    Larry

    Although I own an older version of TT Pro I do not have it installed. I do not remember exactly what they install that is running in the background. What you might do, if it isn't in the documentation, is download Easy Find - CNet Downloads or MacUpdate - and use it to search for "techtool" or "micromat" which should find the item or items. However, I'm almost sure you could disable it in TT Pro's control panel for what to install.

  • Low speed of hard disk while copying or deleting files

    Why I am a heavy file copy, past my system is very slow?
    tazik wrote:/dev/sda:
    Timing cached reads:   20482 MB in  2.00 seconds = 10253.69 MB/sec
    Timing buffered disk reads: 374 MB in  3.02 seconds = 124.01 MB/sec
    [ali@Arch ~]$ sudo hdparm -t /dev/sda
    tazik wrote:/dev/sda:
    Timing buffered disk reads: 392 MB in  3.01 seconds = 130.30 MB/sec

    tazik wrote:What should i do???
    When I will transfer or delete  a large file , my system too slow work even for a few seconds to lock it!
    It is very annoying..
    I got in Google Search But I not find use...
    Sorry. My English is very bad
    I encountered your problem myself, when transferring large files via usb.  The desktop GUI would be virtually locked up and frozen, keyboard response was very slow.  I would hit ctr + alt + f1 to swith to a terminal and I would have to wait 60 seconds or more for the keypress to be recognised.  I believe its a bug in the linux kernel somewhere, but I can't recall exactly where I read it.
    -edit-
    I think this is the thread..
    https://bbs.archlinux.org/viewtopic.php?id=112846&p=1
    One suggestion, among many, was to disable 'usb legacy support' in BIOS.  It worked for some, but not for everyone.
    Last edited by Mustard (2011-11-13 19:34:23)

  • Pages Won't Delete or Open Documents in iPhone 5

    I have the Pages App on my iPhone. Haven't use it in over year. Launched it. Found two documents I no longer need. Went to edit to delete. Held down one documents  I wanted to delete started to jiggle, but the trash can did not turn from ghost to alive, and no dialogue box came up asking me if I wanted to delete the documents. Works fine on my iPad. Can't find help because no document opens. Imported a document with my iphone attached to itunes. That opened, but not the two already on the interface from a year ago.  Any help greatly appreciated.

    1. I always update, backup, and everything else petaining to my iPhone via iTunes. I see the steps.
    2. The Pages App might work, as indeed I imported, added, sync, whatever a document from from Documents.
    3. It opened, and worked normally. Deleted normally. Trash can luminated.
    4. My current problem is this: on the interface of Pages are two documents. I can't open them nor can I delete those documents when I press Edit. They giggle, but the trash basket does not illuminate. Since I can not delete one document I really want to open (called Acting Actions)  I went back and  did the add to sequence with the iPhone, highlighting the Pages App. and "adding to" the document Acting Actions I want to open, but can't delete. It did not make the transfer, because I think it realizes that document Acting Action is already on the interface or been imported, therefore
    5. I really want to delete those documents, so I make a new transfer.
    As to the App Store. I can't see updates in the lower right. If I open the App Store from my dock, I see Updates on top, and that's where it says I can't install Pages unless I upgrade to Maverick.
    Lastly, remember Pages current works in the iPhone, via importing a new document. I just don't undersand why these two documents sitting on that interface won't open or delete.  Thanks again.

  • Deleteing files/folders from network drive

    I have a USB drive connected in to my Airport Extreme and I have conifgured user level access accounts for this. The four the iMac G4, iMac G5, iBook and Powerbook are all able to copy and delete files/folders with no problems. My Windows Vista machine is able to copy files/folders but I am only able to delete folders when they contain no files or sub-folders - sadly I do not have access to the full message but it is related to not having the correct permissions.
    The USB drive is Mac OS X Extended format as a Fat 32 format drive did not appear on the network (this was before the recent Airport update though).
    Has anyone else encountered this problem and if so - do you know of a way around it?

    Guess it's just me
    Any ideas?

  • Problem with Open document SSO using websphere.

    Hi All,
    I have a issue,
    We configured AD SSO using websphere and its working fine but when we try to login to the open document SSO using websphere it prompting for login credentials.
    Is there any steps needed for configure open document SSO using websphere.
    We made all the changes in web.xml file for the Open Document ,same as in Infoview web.xml file.
    When we launch the Open Document, it prompts for the login screen, we get username and passwd fields we do not get the authentication drop down,if we give the AD credentials , we get "Enterprise Authentication error" .We feel the default authentication mode is taken as "Enterprise".
    We have made changes in the web.xml for open document to have authentication.dafault as "secWinAD", also ,for test purpose we made the authentication. visible as "true" but the changes were not taken, we have redeployed the war files.
    Any one please help on this.
    Environment Details-
    BOBJ XI R3.1 SP2
    Web Sphere 6.1.0.25  .
    Thank you in advance.
    Thanks & Regards,
    Bill.

    The same settings in the infoviewapp web.xml must be applied on the opendocument web.xml. Also you must be on XI 3.1 FP1 or higher. There is currently an Edge issue being investigated.
    Regards,
    Tim

  • Not able to copying files/folders from one Document Library to another Document Library using Open with Browser functionality

    Hi All, 
    We have SharePoint Production server 2013 where users are complaining that they are not able to copy or move files from one document library to another document library using “Open with Explorer” functionality.
    We tried to activate publishing features on production server but it did not work. We users reported following errors:  
    Copying files from one document library to another document library:
    Tried to map the document libraries and still not get the error to copy files: 
    In our UAT environment we are able to copy and move folders from using “Open with Explorer” though.
    We have tried to simulate in the UAT environment but could not reproduce the production environment.  
    Any pointers about this issue would be highly appertained.
    Thanks in advance
    Regards,
    Aroh  
    Aroh Shukla

    Hi John and all,
    One the newly created web applications that we created few days back and navigated to document library, clicked on “Open with Explorer”, we get this error.
    We're having a problem opening this location in file explorer. Add this website to your trusted and try again.
    We added to the trusted site in Internet Explorer for this web application, cleared the cache and open the site with same document library but still get the same above error.
    However, another existing web application (In same the Farm) that we are troubleshooting at the moment, we are able click on “Open with Explorer”,  login in credentials opens and we entered the details we are able to open the document
    library and tried to follow these steps:
    From Windows Explorer (using with Open with Explorer), tried to copy or move a files to
    source document library.
    From Windows Explorer moved this file to another destination document library and we got this error.
    What we have to achieve is users should be able to copy files and folders using
    Open with Explorer functionality. We don’t know why Open with Explorer
    functionality not work working for our environment.  
    Are we doing something wrong? 
    We have referred to following websites.
    we hope concepts of copying / Moving files are similar as SharePoint 2010. Our production environment is SharePoint 2013.   
    http://www.mcstech.net/blog/index.cfm/2012/1/4/SharePoint-2010-Moving-Documents-Between-Libraries https://andreakalli.wordpress.com/2014/01/28/moving-or-copying-files-and-folders-in-sharepoint/
    Please advise us. Thank you.
    Regards,
    Aroh
    Aroh Shukla

  • I accidentally deleted all of my Logic Pro X files and put them in my trash but now that I copied them back to my documents they all play in the wrong places in my projects

    I accidentally deleted all of my Logic Pro X files and put them in my trash but now that I copied them back to my documents they all play in the wrong places in my projects

    Buddhaguru wrote:
    I know that Mac's don't have a roll back like PC's
    They do. It's called Time Machine.
    You need to reinstall all of your Apps. That should replace all of the support files you nuked.

  • Defining event handlers for renaming, moving, copying and deleting of files.

    Hi every one.
    I had created a tool for InDesign CS6 written using Javascript to manipulate portions of text in nested way by marking them with small non-printing small anchored text frames contains sequenced numbers and storing these portions as snippets in a spicific folder beside the InDesign documents.
    This tool is open source and free of charge, the only this that I want from you (after downloading) as a user to feedback and as a developer to improve it and join me.
    sourceforge.net/projects/livesnippets
    My question is not about this but I want to trace when the user rename, move, copy or delete a file of these snippets or any container folder and interact according to that by reserving the links between snippet files and their instances which interspersed in InDesign documents.
    Thanks.

    Here is an example of using Bridge events… What this scrript will do if you add it to Bridge scripts… is set *all* indesign snippets in the folders you browse to… to be locked/readonly… This means that users will get an extra dialog if they want to delete the file… Finder or Bridge… You can't just rename the file Finder or Bridge… and Bridge's Batch Rename will only function if the user makes copies to new location… You could set this property using the File Object with indesign…
    #target bridge
    onDocLoaded = function( event ) {
        if ( event.object instanceof Document && event.type == 'loaded' ) {
            lockIDSnippets();
            return { handled: true };
    function lockIDSnippets() {
        var i, count, doc, thum;
        doc = app.document;
        count = doc.visibleThumbnailsLength;
        for ( var i = 0; i < count; i++ ) {
            thum = doc.visibleThumbnails[i];
            if ( /\.idms/.test( thum.spec.name ) ) {
                thum.spec.readonly = true;
    // Register event handler
    app.eventHandlers.push( { handler: onDocLoaded } );

  • Failed to Open Document (file not 0 bytes) - Suggested resolution!

    (Posting this to assist others with same problem - I have actually resolved for me - please note Adobe developers for suggested improvement for work around… there is still a bug in there somewhere with corrupt files)
    Using Flash Pro CS6 (v 12.0.0.481) on Mac OSX 7.5
    Problem:
    Tried to open a file that I was working on last night (after MAC crashed and untidy shut down, but had saved file beforehand) this morning and got the error message "Failed to open document". The file has 10 MB of size (not 0 bit like other crashes that were not recoverable!).
    Resolution (work around): 
    Managed to recover the file using a combo of ideas I found on the web.
    First things first... check the file size, if the file size is 0, your pretty much stuffed since the file is empty, sorry. If however the file is populated, then this is what I did:
    1) copied the file and saved it to a new location (so working on a duplicate)
    2) downloaded a rar file tool (Winrar or I used The Unarchiver for Mac)
    3) Change the name of the file extension of that duplicate to .rar (you will get a warning message, accept it)
    4) Double click on the .rar file to open it using the .rar extraction ap you selected - you will be asked to say where you want that file to be extracted to - I just created a new folder on my desktop. In the process of extracting that file (believe it or not it is stored up as many parts), I got error messages that 3 images that were used in the file were corrupted. I selected to continue and ignore that. I made note of the corrupted files set.
    5) Locate the problem files (mine were in a folder called "Library" in the extracted file set) and delete those images *NOTE: you should have these copied elsewhere since they are brought into flash generally. BUT you might also like to skip this step and try the step below first - I didn't - it could be that you don't actually need to delete those images. If the step below doesn't work, then come back here and try again)
    6) In the new extracted file directory, there should be the same file name you want, just not as .fla but as a .xfl version. This means an uncompressed version (I have no idea what that really means) - double click on that same named file.xfl
    7) This .xfl file then opened for me in Flash
    8) Save that file again as .fla, add back any images that were needed and corrupted - mine were not needed so I just left them.
    I love working with flash but the instability is really a problem - I pretty much have to save a working file to another location and then try to reopen that before closing the original or shutting down / restarting.  This time I was lucky (only 1 hour of research and trial and error to recover) but previously I have had 0 byte files and had no choice but to start again (since time machine failed to save earlier versions).
    Suggested resolution adobe developers:
    It would be very useful if Flash told you which files were corrupted and then gave you an option to open the document with corrupted files removed as a copied version - at least this way we could work with most of the file to rebuild.

    This problem has been around for years and the solution you suggest is only the second best in my opinion.
    The best would be to have a Failsafe like many other products/companies already have going: Corel, Autodesk, Microsoft etc.:
    If their programs stop working they alert you to the fact and give you the opportunity to safe a copy of the file under a different name.
    Can`t be Rocket Science. If you can`t make your products work reliable, at least come up with manageable solutions.
    There is at least one day a month were I would be really lost without the ability of our company to rewind to the xfl version of yesterday.
    I can`t imagine what someone that works as a freelancer and hasn`t got the redundancy of companies has to go through if Flash burns him/her on a regular basis.

  • Copy and Pasted Items Open Original File

    How can I stop items that were copy and pasted from one document to another to stop opening the original (copied from) file when selected in the new (pasted into) file?

    InDesign works different than other programs you may be used to, which is causing your problem.
    When you want to include a graphic, don't copy it and paste it into InDesign. In general, that will produce a low-resolution copy. Instead, choose File > Place, and navigate to the graphic you want to include on your hard drive, and place it. That creates a link to the external graphic. You'll be able to view the link in the Links panel (Window > Links).
    It would also be better to create a new text frame with the Type tool, and paste content into it; or to choose File > Place to place an external file, like a Word document.

  • Hi, I cant open a document I have been working on. It has previously been saved without a problem now all I get is a box stating that the file cannot be opened. Any suggestions please?

    Hi, I reecntly purchased a Mac and the Pages App. But now I find that I cant open a document I have been working on. It has previously been saved without a problem now all I get is a box stating that the file cannot be opened. It is visible in both the Pages Windows and under Recent Items but just will not open. Any suggestions please?

    Hi Colourdoodles,
    Maybe the document is corrupted. Can you open other Pages documents? Preview may open it. Right click (or control click) on the document in Finder and Open With > Preview.
    If that works, Edit > Select All, Edit > Copy. Then paste into a blank Pages document. Formatting may be messed up, but you will have editable text. Then Save (with a different name), close and see if you can open the new document.
    Regards,
    Ian

  • How to import multiple XML files into one inDesign document without copy/paste ?

    I use InDesign CS6, and I have several XML files with the same structure. Only the data are different.
    I created  an Indesign layout with some tagged placeholder frames on merge mode, for automated layout.
    Today for each XML file I have to create a new InDesign document to import the XML. Everything works fine. Then in order to have all Indesign layouts one after the other into a single Indesign layout, I have to use the copy/paste function.
    I mean for example, copy the contents of all documents to the first one. Or add pages of other documents to the first one, then delete spaces between each page.
    So my question is the following:
    How to repeat this process without copy/paste function, knowing that the
    number of XML files could be unknown.
    Thank you very much for your answer.

    Yes, effectively I would like to catalogue the files into one collection so i can save as one PDF and Print as one.:)
    I know I could save each AI as a pdf them then merge the pdf's together in acrobat, but I have nearly 100 files so would feel more comfortable seeing them all together before print / saving.
    My concern is that if I insert them in Ai, will the file resolution reduce? and will the ai still be editable and would it update the indesign file?
    Thanks for the quick reply

Maybe you are looking for

  • Discount in separate GL Account

    Hi, we want to capture the discount on order(order management) in separate GL account, Oracle receivables automatically reduces the revenue (Debiting the Revenue account automatically),urgent help is required. Regards Farhan

  • Illustrator file losing quality when opened in photoshop...please help!

    Hello, If anyone could help me I would be so grateful, i really am struggling to the point of tears here!! I have simple line drawings in illustrator (outlines of clothes) that I wish to open in photoshop to add colour and effects to. When i have tri

  • Wide Report printing issue

    Hello everyone, I have a wide report in pdf and spreadsheet format. It has too many columns. It does not even fit on a legal size paper. I am using reports 10g to develop this report. When I print the pdf format on legal paper, the report is shrunk t

  • Internet logging in problems.

    I have a Macbook Pro 15 inch using OS  10.4.11. I use Firefox. Here lately, I have been having problems getting on to the internet. I have Uverse dsl modem and my apple airport connected to it. Every now and then, I would have to disconnect and recon

  • To add new characterstics to a report group

    Hi, We have created a report group under 601 library. Structure used is CCSS. But we need the field currency type to be added as a characterstic. Since it is not avialable in CCSS we are unable to do that.Please suggest a way. Thanks, Seema.