Does File.renameTo() move files smartly or does it do a dumb copy/delete?

I have to move very large files to a different folder within the same file system, in Solaris (actually a mounted NFS-based Filer - that supports NFS RENAME), instantaneously.
This is possible if the O/S level call is smart enough to leave the physical file where it is and just change the file handle information.
So... are Solaris and Java smart enough to do this automatically when we call renameTo()? Or is it using the brute force method?
If it is using the brute force method, are there any issues I need to know if I use the exec() method to spawn a Unix process to do the move? (I ask because somebody in my office thinks that Java has problems with 'hung processes' when it spawns calls to Unix commands in Solaris - I have not experience this behavior personally)
Thanks,
Bruno

I had tested, with a 100Mb file, all within a single filesystem, with the following results:
Unix 'cp' command - on Solaris w/ Filer: 2-4 seconds
Java renameTo() - on Solaris w/Filer: 4milliseconds
Java renameTo() - on Windows w/LocalDisk: 0milliseconds (or more correctly < 1)
From that it 'looks like' the renameTo() command when applied to moving a file withing a single filesystem will leave the file in place and simply change the file handle information.
I posted because I wanted to be absolutely certain. There is a fairly dumb unix script that I have no control over to moves the files from my 'destination folder' into an archive. Corruption could have happened if the file was still being physically copied by my app (as opposed to the file handles) when the other process 'found it' in the directory and tried to grab it. But since - as you indicate - renameTo() only changes the file handles... that script can't see the file until it is fully available. Much safer.
Thanks for the confirmation.
Bruno

Similar Messages

  • How do I make a DVD copy of a file? And does the file have to be converted from mpeg or mp4 or.MOV to a different format before it can be copied and is readable by DVD? Thanks.

    How do I make a DVD copy of a file? And does the file have to be converted from mpeg or mp4 or.MOV to a different format before it can be copied and is readable by DVD? Thanks.

    Great hearing for you all! I thought I was all alone this past weekend. I did learn a lot this weekend. I really like the InDesign product.(half-the-battle) But to be helped by the prestigious “Sandee Cohen” was an honor indeed.”  I ordered the InDesign CC today.  Peter, I appreciate all the feedback on Lynda too. They are loaded with lots of good videos. Derek too honed in on one of the most important aspects!  Since I have been working with Word for most of the first portion of the book this will be a big help. I looked at the comments big help ! Thanks a ton ALL!  Have a wonder day or evening whenever you read this reply.

  • Why does the new operating system not delete the moved files from their original location - it seems like an enormous waste of space, time and effort to clean up every file once you've moved it

    Why does the new operating system not delete the moved files from their original locations - it seems like an enormous waste of space, time and effort to clean up every file once you've moved it - also, when transferring large amounts of files it becomes a very large problem remembering which files were transferred and which not.

    You're going to need to be more specific, as I'm not quite sure I understand what you're talking about.
    If you're referring to copying from an external hard drive or flash drive, and you want to actually move files rather than copy them, you can hold down the option key to force it to do a "move" rather than a "copy." This is not new behavior, though... the Mac OS has worked this way as long as I can recall (and I've been using it since 1984).
    If you're having a problem with trying to move files from one place to another on a single drive causing them to be copied instead, that is likely because of some permissions issue preventing you from actually being able to move them.

  • I am using the desktop screensaver and a file from dropbox for photos.  Does the list of screen savers actually use the file, or just link to it.  If I delete the file from the dropbox, will the screen saver be lost?

    Using the desktop slideshow, I have added a file from dropbox for the slideshow.  If I delete the dropbox file, does that delete the file from the list on the slideshow?  Do I need to leave the file on the computer itself rather than in the dropbox and then delete it from the dropbox?

    If you are going to delete the file from Dropbox, you will need the file on your computer.
    You will probably need to put the file in Library/Screen Savers

  • Does anyone know how to copy my files from my ipod to a different computer?

    Does anyone know how to copy my files from my ipod to a different computer? I tried to do it, but all that it did was erase my files. What i want to to is use my ipod to transfer my files to another computer (which has itunes as well) PLEASE help!

    You will need to enable your iPod for disk use. Then, you should see your iPod in "My Computer" and you can open up your iPod's folder there and drag the files into it. You can store the files on the iPod, then connect it to the other computer and drag-and-drop them from the iPod into the designated directory in that computer. Make sure individual files are not larger than 4 GB.

  • How do I move a smart catalogue file from my Vista computer which has LR4 to my IMac which has LR Creative Cloud. Please explain in layman's terms!

    How do I move a smart catalogue file from LR 4 on a Vista laptop to an IMac where I'm using LR CC? Please use layman's terms as I am new to the IMac.

    You might think so. But it's difficult to decide what people mean. You understood the question, I didn't. If you copied the catalog and everything from the old computer to the new one and utilized the old catalog, the smart collections should still be in place. The old catalog would have to be converted to the new format, and you might have to relink missing images. But after that is all done the smart collections should be in place.

  • Exfat drive does not free up space after deleting files

    My external exfat formatted drive does not free up space after deleting files using a mac....however if I delete files using a PC, it will free up space.
    I've even tried the *erase free space* using Disk Utility, but nothing.....
    Thoughts/Suggestions??

    Thanks for the suggestion.
    I ran WhatSize and here is the result. Oddly, it says there is 40.2 GB used (in the top-left) which conflicts with the information directly below it: "Capacity 108 GB, Used 103GB, Available 4.27 GB". Not so helpful.
    Disk Inventory X solved the problem, however. Much thanks! I wasted most of my weekend troubleshooting this sad issue. Anyway, Disk Inventory X revealed a bug where my external hard drive for photos was still appearing as a mounted volume, even though the HD was no longer connected. Freaky.
    After moving it to the trash and deleting it, I've recovered the space.
    Again, thanks! Contact me if you're curious about the details, as this might help you diagnose similar problems in the future.
    - Mike

  • If I import files from my hard drive to a catalog, does it index the original copy or make new one

    If I import files from my hard drive to a catalog, does it index the original copy or make new one

    The one exception to MichelB's answer is if you use the "from iPhoto" command in the mac organizer. In this case the organizer does copy the contents of your iphoto library, since if it wrote any information into that library it could easily corrupt it and cause the loss of the photos it contains.

  • If a drive is encrypted (format level) does this mean any un-securely deleted files remain encrypted?

    If a drive is encrypted (at the format level i.e. Journaled Encrypted) does this mean any UN-securely deleted files remain encrypted? Thus empying your trash with secure erase on is redundant?

    I would think the files are safe - while the drive is encrypted.
    I would think once the drive has been unlocked then apps like data rescue may be able to lift previously deleted files from the drive. Might be worth trying it out.....
    I think with an encrypted drive, all bets are off once the key is entered, it would appear as any other drive at that stage.

  • I can't move or drag any folders/files/documents/emails anymore. I have to copy and paste them which is frustrating. How do i fix this?

    I can't move or drag any folders/files/documents/emails anymore. I have to copy and paste them which is frustrating. How do i fix this?
    I'm on the lastest software, and my computer is less then a year old.
    Please help me!

    If third-party software called "Air Display" or "AirParrot" is installed, remove it according to the developer's instructions, then restart the computer. Back up all data before making any changes.

  • IPad2... after synch with my Mac, I now have numerous duplicates of the same PDF files in Books.  Can't select them to delete them.  Can't move them.  Any suggestions?

    iPad2... after synch with my Mac, I now have numerous duplicates of the same PDF files in Books.  Can't select them to delete them.  Can't move them.  Any suggestions?
    <Email Edited by Host>

    Hi sdfulbright,
    Open iTunes, and under View, select "Show Sidebar". The old sidebar you are used to will show up, and everything will work the way it did under the old iTunes.
    Hope this helps!
    Cheers,
    GB

  • HT1338 I made a movie in iMovie and want to make copies.  I lost the iMovie file, I just need to know how to copy a disk.  HELP!

    I made a movie in iMovie and want to make copies.  I lost the iMovie file, I just need to know how to copy a disk.  HELP!

    Not sure if you really mean disk (HD) or disc (CD/DVD).  Check out this YouTube video

  • How do I delete documents from my iPad that were added when it ran regular Acrobat, now that it has switched to DC?  The docs are not on the cloud, and DC does not seem to have a delete function for non-cloud docs.

    I use an iPad.  It automatically switched me from old-fashioned Acrobat to DC.  How do I delete docs that were put on my iPad with the old Acrobat?  They are not in the cloud, and DC does not seem to have a delete function for them.

    Hi,
    By default, Acrobat DC for iOS displays recently viewed files.  You need to switch to other file location (such as Local, Document Cloud, Creative Cloud) to delete, rename, move, or duplicate files.
    You can switch to Local, if you would like to see the files and folders that are locally stored on your iPad.
    Would you take a look at the following document to see how you can switch to other file location and delete files?
    How to manage files in Acrobat DC for iOS
    Please let us know if you have additional questions.  Thank you.

  • How to copy/delete file

    hi,
    i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.
    does any one have any idea how am i going to code the abap program for this?
    thanks

    > i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.
    >
    i am assuming that your Application server is Unix.
    unixcommand cp is used to copy the a file from one directory to another.
    cp /dir/file1 /dir2/file2
    the above command will copy the file1 of dir1 to file2 of dir2.
    for delete use the command rm,
    rm /dir/fiel1
    the above command will remove the file1 from directory dir.
    REPORT ZUNIX line-size 400
                    no standard page heading.
    parameters : unixcom like   rlgrap-filename.  
    data: begin of tabl occurs 500,
            line(400),
          end of tabl.
    data: lines type i.
    start-of-selection.
      refresh tabl.
      call 'SYSTEM' id 'COMMAND' field unixcom
                    id 'TAB'     field tabl[].
    "if any error or any thing you get in the tabl
    "just check the tabl once after the finishing

  • FAQ: File Basics: How do I Upload, Download, Share, and Delete files in Revel?

    FILE BASICS
         Libraries:
    The top level of organization is Libraries
    Libraries can contain several albums.
    Libraries can have collaborative users that are invited to share. (requires Revel Premium) Invited users have access to add, delete and edit files. They must have a Revel account to do this.
         Albums:             
                     Albums contain photos
                     Albums cannot contain other albums
                     Albums can be shared with other users. They can be viewed, but not added or deleted by these users. People who view albums via shared links to not need to have a Revel account.
            *See SHARING topic below.
    CREATING LIBRARIES IN REVEL
    If you are a premium user, you can create additional libraries in Revel.
    CREATING ALBUMS  IN REVEL
    You can create new albums in your  revel library easily to help organize your photos. You can not have albums within albums. (nested albums)
    REVEL UPLOAD/IMPORT PHOTOS- copying files to Revel (cloud)
    From IPad, Iphone, Mac:  Upload to Revel is possible
    From a Browser: Upload to Revel is possible
    FROM Elements: Upload to Revel is possible
                How Do I upload files to Revel?
    REVEL DOWNLOAD/EXPORT PHOTOS FROM REVEL
    To Mac, IPhone, IPad:  export from Revel is possible (single or group export)
    To Android devices: export from Revel is possible (one file at at time)
    To computer using a web Browser: export from Revel is possible (one file at at time)
                 How Do I Download files from Revel?
    DELETING PHOTOS IN REVEL
    Deleting a file in Revel removes it from Revel (no devices will see it now) and removed it from the Elements Organizer. It should remain on the device in the original location.
    FAQ: How do I delete a file from Revel?
    DELETING FILES AND ALBUMS IN REVEL
                 FAQ: How do I delete a file or  an album from Revel?
    EDITING FILES IN REVEL
    You can open from and Save to Revel in the editors on mac/iphone/ipad. When you edit, your device will download the full image rather than having just the thumbnail.
    FAQ: How do I edit photos in Revel?
    SHARING FILES IN REVEL
    Collaborative sharing- can be done at the library level only. Other users are invited by email and must be logged into a Revel account to see the shared libraries.
    Read/download only sharing- can be done at the album level- a link is sent and the user does not need Revel to view them.
    Sharing of individual photos not currently available, creating your own personalized link name is not available
    FAQ: How do I share my photos in Revel?

    Hello All,
    As all you said I have used apache third party jars to upload a file into server.
    Thanks for help me out regarding this issue.
    But Now what the problem is When I run this locally it is running fine.
    When I deploy it on server It is giving the following exception.
    SRVE0026E: [Servlet Error]-[UploadLetter]: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUpload
    these files are in classpath.and successfully compiled but in runtime this is happening
    can anyone have any idea on this..??
    Please help me out.
    Thanks in advance.

Maybe you are looking for

  • About Boot Camp and Parallels

    Can I use the Windows Xp that I installed by Boot Camp for Parallels? In the other hand, Do I need a Windows installation for Boot Camp and other for Parallels? Thanks in advance.

  • PSE 7  file to big in organizer

    When I work with a canon raw (.cr2) file from my 50d and came back to the organizer, I get the message 'file is to big' in the organizer view. What can I do?

  • Connecting USB Hard Drive

    I am trying to make a MyBook USB HD available on the network. I am trying to use a Airport Extreme (not n). The problem is that the HD is not recognised and seen in the Finder window. It could be I am not looking or I have set up wrong. All I have do

  • Oracle Report

    Hello all, I have just been given the task to find a suitable reporting tool for our application. Currently our web based application has been developed using Javascript, pl/sql packages etc with OAS and Oracle 8 database. The database will be upgrad

  • Comparing two List values using Oracle Business Rules

    Hi all, i just need to know how to use the Oracle Business Rules to Compare 2 list types say for example list1( 10,20,30,40) and List2(10,50,60). when i compare both the list using the business rules the rule should return true if there is atleast on