Possible to lock file and move it afterwards?

Hi Java-Gurus,
I am trying for quite a while now to lock a file (with FileChannel/FileLock) and to move it afterwards.
At the moment it seems like the file is locket for my java application as well as for other applications.
Is there a way to lock the file first, read it and then to move it to another directory?
Thanks for your help!

I don't believe you can move a locked file, even if you locked it.
Instead of locking the file you could move it to another directory (only one process can do this successfully) and move the file again, if required, when you are finished. No locking required.

Similar Messages

  • DW CS3 locked files and FTP issues - cannot update pages

    I just upgraded to Dreamweaver CS3 and now cant seem to
    update any of my web pages. I can connect to the server etc and see
    my files locally & remotely but when I try check out a file to
    update it I get an error message saying 'index.html is a locked
    file and can be viewed but not changed'. All I can do with it is
    view it. When I try to unlock any files locally nothing happens????
    This was not an issue before I upgraded.....I have checked my
    FTP details with a version on my pc and there are exactly the
    same.....does anyone know is this an issue with mac version of
    Dreamweaver CS3?
    Help!!!

    Can you post a link to your child or template page and tell
    us what you have
    changed that didn't propagate?
    Here are seven common mistakes that will result in changes
    not propagating
    from Template to child -
    1. Rename the Templates folder
    2. Move the Templates folder to some other folder level in
    the site other
    than root level
    3. Move a template out of the Templates folder.
    4. Make changes to an editable region of the template (which
    will not
    propagate)
    5. Assume that template changes can be uploaded to the server
    without also
    uploading the changed local files
    6. Corrupt the site cache so that the link between template
    and child page
    is broken
    7, Improperly create your child pages by simply opening the
    template,
    adding page specific content, and resaving the template with
    an *.html
    extension rather that its *.dwt extension. (you can tell if
    this is the case
    by looking at the code on a child page - if you see anything
    like <!--
    TemplateBeginEditable... then this is what you have done). If
    you *have
    done this*, then recreate the child pages (in DWCS3) using
    FILE | New > Page
    from Template, select the template and click CREATE.
    The 6th problem can be repaired by using SITE | Advanced >
    Recreate Site
    Cache, and the six others can be fixed by just not doing
    them. Have you
    done any of those?
    Or, read this -
    http://www.adobe.com/go/dd83ba8b
    By the way, this is not an official communication vehicle to
    Adobe. We are
    all just volunteers and peers here.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "gwbusiness" <[email protected]> wrote in
    message
    news:[email protected]...
    > Hi honeybugs,
    >
    > I am having the same problem and I need a global fix so
    that I can
    > immediately
    > update my site . . . did Adobe help you? This did not
    happen immediately
    > to my
    > files but my template does not now update pages . . . I
    am desparate.
    >
    > Thank you,
    >
    > Gail
    >

  • I recently thought I was updating my Safari browser. When completed, I put all those little files that were on the desktop into the trash. Now my trash is saying it can't be emptied because there are locked files and I don't know how to unlock them

    I recently thought I was updating my Safari browser. When completed, I put all those little files that were on the desktop into the trash. Now my trash is saying it can't be emptied because there are locked files and I don't know how to unlock them or get them out of my trash and they keep multiplying. And to make matters worse, I tried renaming them as pdf files thinking that might do the trick.

    oh boy ! I'd ask you if you knew what kind of files they were or where they came from, but I don't think you could help me a bunch. Try going to the Utilities folder and running Disk Utilities.  If you want to empty the Trash and it won't empty, go to the finder and choose "secure Empty trash". Worse case scenario-you may have to reinstall Snow Leopard, but I don't know what else to suggest. If you have a DVD of Snow Leopard, boot up from that,  and reinstall the OS. This will not touch the stuff you have on your Hard Drive, then you can update from 10.6 to 10.6.8, otherwise Onyx? Maybe those files are part of the OS which needs them to keep running.  if you hold down the Shift key on reboot, you can reboot in Safe mode and maybe you can take the files out of the trash that way
    good luck
    John B

  • Have updated my mail but i cant import my old messages as i am told that I do not have enough room on my HD but when I deleted files and movies an hour ago and now it says i still don't have room.

    I have updated my mail but when I try to import my old messages back I am told That I do not have enough space I then deleted a number of files and movies and still got a warning message of not enough space

    Did you empty the trash (click on Finder) after deleting the files/movies?

  • Hi, I have downloaded some avi files and mov files. i am not getting audio while playing the movie. i tried to play with iTunes, QT, DivX player. but I am getting audio in mp4 files. can u help me to fix this

    Hi, I have downloaded some avi files and mov files. i am not getting audio while playing the movie. i tried to play with iTunes, QT, DivX player. but I am getting audio in mp4 files. can u help me to fix this

    First, back up all data and then uninstall "DivX" according to the developer's instructions.
    Then try this:
    VideoLAN - Download official VLC media player for Mac OS X

  • How do I archive a processed file and move

    This is not our standard. Our standard is to output the extract file, then
    archive a copy. The reason is that a process usually comes along afterward and
    moves the file to another location.
    Also within scope of this item is the need to confirm that any successor
    processes like copying the file actually move the file, when the successor(s)
    are done, there should be no file left in the 817 folder so that we know the
    processing happened.

    Presently it  is the last run that is going into the achieve. I want my current run as well to go into the achieve at run time.
    The exe is an automatic set up for the archieve folder.
    A different job will be processed to take away the folder as indicated in the requirement and at that point in time there should be no file in the 817 folder anymore.
    Hope it is clearer now.
    So how is it controlled currently? Using a conditional precedence constraint?
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Jump between PNG file and Mov file

    We are creating an iPad application, in it we bring 3 different elements to screen using a MP4 video clip, once the movie ends, we load a PNG file and have each of the 3 elements as different touch points. When you click 1 element it opens a related MP4 video clip. Therefore, 3 items open 3 different video clips. The problem is when you touch one of the elements, there is a JUMP between the PNG file and the Video clip (the video player loading time). What can we do to fix this issue so the applicaiton will run seamless without a JUMP.

    Ravi, is there a possible when you added the png to your primary storyline, you accidentally chose the non option in the spatial conform settings?
    If your image is larger than your timeline frame size, what will happen is if you choose the none option, the image will be added at full frame and centered.
    What you need to do is before adding your png's to your timeline, hilight the png and in the inspector make sure FIT is selected.
    Hope that helps
    Tony

  • How do i drag multiple files and move to a folder

    I just purchased an IMAC and would like to transfer all of my photos from my old Dell laptop to my IMAC. I am using a USB Flash Drive and now I need to know how to drag multiple items and move the the pictures file? it will only let me move one at a time and this will take forever! I have the magic mouse. I have figured out how to choose/highlight multiple photos but i cannot figure out how to drag them over to the pictures file.

    If you're not used to spring-loaded folders, it may be helpful to open a second Finder window (⌘N) and navigate that to the target folder, so you can just drop them straight in.

  • Some Finder Sounds Aren't Working (Trash File and Move File)?

    Last night I noticed that *some of the finder sounds* aren't working (trashing and moving a file/folder) on my mac mini. The rest of the finder sounds seem unaffected (emptying the trash, removing an icon from the dock). I tried some solutions online with limited success.
    Odd things that are happening:
    1) After a reboot, the first time I delete a file or move a folder, the *monitor resets itself*. Kinda like when you change the resolution. My TV loses the feed for a sec and quickly reestablishes it. After this happens, no finder sounds for moving and trashing
    2) I heard some people were having this same problem because of coreaudiod.plist files (Library/Preferences/Audio. When I copy the com.apple.audio.SystemSettings.plist to the desktop these finder sounds return, but just for this file. See http://discussions.apple.com/thread.jspa?messageID=10465859
    3) I noticed these problems after I started using the Kanex Mini DisplayPort Adapter To HDMI 1080p Video w/ Digital Audio. http://kanexlive.com/products/item.aspx?id=3495 But, I tried switching back to the old setup of a basic minidvd to hdmi and a rca y cable and it made no difference.
    4) I also completely did a fresh install and everything worked fine until late in the process after I did a reboot (see point 1). Is it a third party software problem? I installed the HippoRemoteVNC that allows me to take control of the computer with the iphone. I also have installed Plex, Boxee, XBMC, Perian codecs, Hulu desktop, Quicktime 7, and Transmission.
    System Specs:
    Computer: Mac Mini (Late 2009) - 2.26Ghz, 2GB RAM, 10.6.1
    Monitor: Panasonic TH-42PZ700U 42-Inch 1080p Plasma HDTV
    Video/Audio Connection: Kanex Mini DisplayPort Adapter To HDMI 1080p Video w/ Digital Audio
    Any thoughts? Thanks!!

    Go to your /Applications/Utilities folder and run the Audio MIDI Setup application.
    Confirm settings there match your expectations.

  • Bash: unzip file and move into directory if directory created

    I'm writing a script that decompresses zipped/rared files.
    The zips typically have content in a one directory or not contained in a directory.
    Is there a way to see if the unzip process created a directory and move into it or if one wasn't created to operate on the files extracted in the PWD?
    So far the rar files have only had data that gets extracted to PWD, but if I see some with files in directories I'd like for a solution that might work in that case as well.

    Would zipinfo' help?  It lists zip archive files in a format similar to 'ls -l'.
    I only tried this on two zipfiles, and I'm concerned about how foolproof this may or may not be.
    Zipinfo lists the files in the opposite order that they were placed into the zipfile, I think.  If the first file placed into the zip was the parent directory, and so contains all the other files, the listing will be something like that shown below, with the container directory always on the next-to-last line of zipinfo's output:
    -rw-a-- 2.0 fat 1057 tx defX 09-Nov-12 17:56 examples/README.txt
    drwx--- 2.0 fat 0 bx stor 09-Nov-12 16:48 examples/
    42 files, 508682 bytes uncompressed, 133398 bytes compressed: 73.8%
    So one would have to test if the next-to-last line of zipinfo's output begins with 'd' (directory) or '-' (regular file).
    Off the top of my head, with not-so great command-line skills, I came up with:
    zipinfo example.zip | tail -n 2 | grep '^d'

  • Rename files and move them into new folders with part of original file name

    I have tried using automator and other programs such as name Name Mangler with no luck.
    I am trying to have an AppleScript run when files are added to a folder, using a service through Automator.
    File names come in 9 different suffixes, all with the same prefix.
    Example:
    nonspecificprefixSUFFIX
    nonspecificprefixOTHERSUFFIX
    nonspecificprefixALSOSUFFIX
    I am trying to get the program to create a folder named after the prefix, then to remove the prefix from the files after moving them into this folder.
    There are 9 different suffixes that should remained unchanged.
    End goal would be to have child folders named nonspecificprefix, nonspecificprefix2 etc each with 9 files only containing the suffix portion of original name.
    If anyone has any tips to get me on the right path that would be much appreciated! I have thousands of files to rename and move so this would save me loads of time!

    Erwin,
    I was not able to systematically examine this issue, because it occurred on a production system and, of course, I uninstalled the Adobe iFilters as soon as I read that they may delete pdf files. Before the uninstallation I noticed the AR9 folders appearing on c:\ and moved them from time to time to another folder. Using the search function inside this folder, I found that all files were present in duplicate at least. I concluded, that after moving the AR9 folders they were recreated containing the same files. Consequently, these files cannot have been deleted. Searching for the origin of these files I found that they were part of pdf portfolios, therefore my conclusion that they are part of the indexing mechanism of the portfolios. What I have not done (and what I am not going to do since it is a production system) is to fill a folder with pdfs and track what is happening to the files.
    In case of my server, I think that the iFilters did not delete any files. Of course I cannot say what happens on other systems. I am definitely not going to reinstall the iFilters before knowing what they a really doing to the files.
    Not sure if this is of much help
    Michael

  • How to find locked files and unlocked them???

    Having trouble for snxing itunes i need to find locked files but i dont know how and unlocked them so that i can sync again..

    When i connect my ipod into my computer "unknown error occured(-54)" is keep appearing thats why i cant see my library in my ipod.. And i think locked items caused this.. I open once another program that for browsing files to for iphones and ipods and after that the unknown error keep appearing and some of my musics are in grey i cant even delete it

  • Locking files and folders

    I want to lock a few files and folders so they can't be opened without having to enter a password first. Any help would be greatly appreciated....
    Thanks,
    John

    1. Open Applications -> Utilities -> Disk Utility
    2. Go to New menu -> select new below the New Window -> Disk Image from Folder
    3. Select the folder in question you wish to password protect
    4. Below the window where you select the folder, change Compressed to Read/Write, unless you want it Read only in which case you would select Read Only
    5. Encryption select AES-128 (recommended)
    That will let you password protect the folder.

  • Unable to empty trash due to external USB HDD's locked files and no permission?

    Hello.
    I was doing a major cleanup with an external Seagate USB HDD due to low free disk spaces. It has two partitions/drives: FAT32 (using it for on other non-Apple machines like Windows 2000 SP4) and HFS [Time Machine only]). I threw about 30,000 items (copied from an old Windows 2000 SP4 machine's HDD with NTFS back a few years ago) from FAT32 partition/drive into the trash can. However, I am having problems emptying it. Most of them were emptied, but some were left behind.
    This four years old MacBook Pro's Mac OS X 10.5.8's Trash dialog boxes said "The operation cannot be completed because you do not have sufficient privileges for some of the items." and "Emptying the Trash cannot be completed because "<filename>" is locked. To empty everything in the Trash, including locked items, press the Options key while selecting Empty Trash". http://i.imgur.com/XFBfF.gif for the screen shots/captures of the error messages.
    I tried holding Option key and emptying trash, but that didn't help/work. I used Finder to look at the files, and they had locked status. So I unlocked them which worked, but I can't delete the empty folders/directories, and these don't have locked.
    What's going on and how do I empty the trash? Thank you in advance.

    BDAqua wrote:
    Hi again, are there maybe hidden files in those folders?
    Show Hidden Files 1.0...
    http://www.macupdate.com/app/mac/29096/show-hidden-files
    Hidden Way is a toggle for hidden files view in Finder...
    http://www.macupdate.com/app/mac/25716/hidden-way
    Show hidden files in OSX Finder
    Open the Terminal and type or copy/paste:
    defaults write com.apple.finder AppleShowAllFiles -bool true
    Reverting to the default of NOT showing hidden files:
    defaults write com.apple.finder AppleShowAllFiles -bool false
    *Restart or Force Quit Finder required to take effect.*
    http://www.apple.com/downloads/dashboard/developer/hiddenfiles.html
    http://www.burobjorn.nl/blog/?p=96
    Finder Force Quit, or restart required to take effect.
    Not that I saw through Terminal's ls -all and Windows XP Pro. SP3 machine. Someone told me to try secured empty trash and it did more, but not fully.
    I used the administrator (sudo) account in Mac OS X 10.5.8's Terminal to delete the trash, but it still failed: 
    $ sudo rm -rf *
    Password:
    rm: 501/2010/07252010/My Documents/My Pictures: Operation not permitted
    rm: 501/2010/07252010/My Documents: Directory not empty
    rm: 501/2010/07252010: Directory not empty
    rm: 501/2010/01162010and05042010/My Documents/My Pictures: Operation not permitted
    rm: 501/2010/01162010and05042010/My Documents: Directory not empty
    rm: 501/2010/01162010and05042010/Favorites: Operation not permitted
    rm: 501/2010/01162010and05042010: Directory not empty
    rm: 501/2010: Directory not empty
    rm: 501/06182011/My Documents/My Pictures: Operation not permitted
    rm: 501/06182011/My Documents: Directory not empty
    rm: 501/06182011/Favorites: Operation not permitted
    rm: 501/06182011: Directory not empty
    rm: 501: Directory not empty
    I tried deleting this on an old, updated Windows XP Pro. SP3 machine and it had no problems! Weird. I wonder why Mac OS X 10.5.8 failed to delete it through its Finder and Terminal (sudo rm -rf command).

  • Find all music files and move to one folder for all of family to access, find all music files and move to one folder for all of family to access

    I seem to have music files in various places on my laptop, on my husbands computer and our main imac.  What we want to do is put all music on imac so when each of us logs on we have the same files availabe in itunes, but we logon seperately so we can have different playlists and checked music. So here is what I want to do:
    Find all music files on each computer seperately and put everything in one folder one each computer, so three folders total to start...
    Move my husbands itunes library and my itunes library from each of our laptops to our main imac, making one huge itunes folder
    I want to store our music on an external hard drive, which I have, so I have a full library for backup purposes.
    I want all future music downloaded on any of our laptops to transfer to the main imac computer, again to keep one main library
    I want all video, apps, books, etc on each laptop to be available in one file on my main imac also so we can all use them
    So mainly I want to organize, organize, organize and put everything in one spot so things don't get all messed up and some items are only accessible to me some times and not my husband or vice versa.  We want to share everything we can so we don't have to pay twice. I have read many instuctions, but nothing seems to be helping me and was hoping someone could...
    Thanks, l

    I am totally running into the same issue as well. On top of that, when syncing to my iPhone, it took some of the tracks from my iphone and recopied them to the iTunes library, as new files, so now I have a ton of duplicates, and tons of tracks that can't find the iTunes folder, so they have the little "!" next to them.
    It would be really nice to have someone answer this question. I didn't think, moving my iTunes library to a bigger external hard drive would have caused all this madness

Maybe you are looking for