Delete file with write protection

Hello,
Is there any way to delete a file on Windows that is write protected? I have a web program that uploads images into a directory in docroot. The program also displays the images on a web page and allows the user to delete the images.
I have noticed that even after the server displays the images, they are still write protected. I assume by the application server. It doesn't always do this, but sometimes. When it happens I have noticed that restarting the application server corrects it. So, my code to delete the files doesn't work. Does anyone know a resolution to this? I am open to ideas.
File F = new File(fileLoc);
if (f.delete() == false)
  System.out.println("Could not delete" + fileLoc);Thanks
Mike

Someone solved my problem on the Glassfish site. If you are using Glassfish, it can cache or not cache files in the docroot. Caching will set the write protection flag and thus make them impossible to delete.
To not cache, change the file-caching-enabled and globally-enabled to false in the build.xml
<http-file-cache file-caching-enabled="true" file-transmission-enabled="false" globally-enabled="true" hash-init-size="0" max-age-in-seconds="30" max-files-count="1024" medium-file-size-limit-in-bytes="537600" medium-file-space-in-bytes="10485760" small-file-size-limit-in-bytes="2048" small-file-space-in-bytes="1048576"/>
change to
set file-caching-enabled="false" and globally-enabled="false"

Similar Messages

  • Error message when finalizing...file already open with write protection

    I just created my first movie in i Movie. It's about 9 minutes long. When I tried to finalize it it worked for a couple of hours and then came up with a message "unable to prepare project for publishing because an error occurred (file already open with write protection)". What does this mean? I thought I had closed all the files I was using. There was no error number. I tried it 3 times and got the same message. Any thoughts would be greatly appreciated.

    AppleMan, I just checked that and it looks like Time Machine isn't open. I checked it by going to finder>applications>R click on time machine. It gave me the option to "open" which makes me think it's already closed. Is there somewhere else I need to be looking?
    I made another movie that was just a couple of clips and it finalized fine. On that movie, I had some MTS clips and I converted them to mp4's so iMovie could read them.
    In the one that didn't work I did clip one of the movies before I imported it into iMovie. It saved as a .mov instead of a .mp4. Would that make a difference? I checked all of the files and none of them are listed as locked, so I really don't get the "write protected" aspect of this error.

  • How can I move or delete files with PL-SQL???

    I have Oracle 9i and Sun Solaris 5.8
    I have a table (“TABLE_FILENAME”) with the files name in one directory. (I read the files name in a directory and put it in a table). I charge some files with external tables and then I have to move some fields to another directory and delete others files.
    How can I delete files with PL-SQL and How can I move files with PL-SQL?
    I have the names of files and the actions (Delete o Move) in a table (“TABLE_FILENAME”) (The files in this table are dynamics).

    If you're using 9i then you will find that the new functions UTL_FILE.FCOPY and UTL_FILE.FREMOVE will allow you to do what you want. Check out the documentation for more details.
    Cheers, APC

  • Cannot open project file with write access...

    I have seen that this problem has been reported before but have yet to find a solution.
    I have my project file in an external hard drive.  When I plug the hard drive to another computer and want to save it I get this message:
    "Cannot open project file with write access.  The file may be locked or you don't have permission to write to this location.  Select Save As..."
    I don't want to Save As because other projects make reference to this file and also my Encore file will be messed up.
    FYI both computers use Windows 7.
    Any solutions?

    Right click on the folder in Question and select properties. Then select the security tab. Make sure you add everyone to the user list. You do that by selecting edit and then add. Type in everyone in the object section and hit ok. Then select the everyone user and checkmark the Full control. Hit Apply and it will adjust the permissions for the folder and subfolders and files.
    Eric
    ADK

  • Old music files with DRM protection

    I have some old music files with DRM protection.  I don't see an option to pay for an upgrade so I can get DRM-free files.  Is there a way to do that?  I keep reading posts about iTunes Plus but they're all old posts so I assume that option is gone.  Thanks!

    It is back from time to time.  Keep watching under quick links

  • XLS file with password protected

    Hi,
               I have a requirement to create a XLS file with password protected (Data from internal table) and send the same through mail. Can any one help me how to deal this through abap code?
    BR,
    Praveen.

    Hi Praveen,
    With OLE it is possible. Refer [Excel with Password|OLE2 Excel File Save as password protected;
    I am not sure if you can set the password and send it directly.
    Regards
    Rajvansh

  • How could I delete files with name string with "TAL" and older than 05.05.

    How could I delete files with name string with "TAL" and older than 05.05.2009 on unix

    Our ECC Ides system today was not responsible. For first time 17 users were working on the systtem (IWN2008/SQL2005 based). Before the people were maximally 5.
    The server is done by making a homogeneous system copy from an blade machine(now it is an VIrTUAL)
    There was enaught disk space. However I checked Wokload 03sdn transaction) inn system. and found out that at that time of restarting(I had to restart system 3 times to get logged on the system and even then it was almost unresponsive.
    I can found in there top abap."Login_Pw", "SESSION_MANAGER", "?". (BAtch), "ADMSBUF, >DEleyed Function call, RSPOWPOO""RSWWclear", ""VA01", "SAPMHHTP  "Buf  Sync" >DDLOC CLEANUP)""rsbtctE"
    What can I do?
    ¸
    Who could interfer SAP_CCMS_MONI_BATCH_DPSAP_CCMS_MONI_BATCH_DP
    the 2 main users under users profile were ZUGTIN running and SAPSYS( running many system jobs)
    How to approach the problem

  • CAPL browser shows that the .can file is write protected while it is not and keeps toggling, CPU performance reach 100%

    The problem is when I open the CAPL browser, the CPU load increases to 99~100%, and the .can file I am editing can't be saved, and I keep getting the message "file is protected and can't be saved". This happened on multiple machines with different CANoe versions. 
    I tested on these versions: 
    8.0.36
    8.0.71
    8.0.93
    8.1.60
    Randomly the icon of the "write protected" appears beside the file name in the file tab inside the CAPL browser, if I could press the save button while it is not appearing the file is saved, other wise I get the error message. The memory usage is also increases too much and then the browser stop responding.
    Do any body had the same issue before? any advice?
    Operating system: Windows 7 Ultimate 64
    AntiVirus installed:  McAfee

    Hi Allaithy,
    Can you clarify how is this issue related to NI CAN products?
    Anyway, here are some things to try:
    Is this the file on a network? Do you have administrator privileges to this network?
    Is file set to Read-only?
    Miro T.

  • Deleting file with special character in name gets error -43

    In my Trash folder there is a .html file with a name containing special characters (oriental) left over from when I uninstalled Adobe CS2. When I try to change the file name to delete the special characters so I can trash the file, I get error -43, and the name won't change. Therefore I can't get the file deleted from the computer because I can't get rid of the special characters.
    Is there another way to accomplish the same thing?

    I presume you are referring to the notorious Vietnamese file. Others have had success getting rid of it wuth these instructions .
     

  • I can't open number files with password protection?

    I am using OSX 10.9.4 with Numbers 3.2.2 (1878) and have one file which is password protected. While opening the file with Numbers, it prompts for the password after correct entry I receive the friendly message: "xxx" can't be opened.  That's it.
    Any solution out there?
    Thanks, Hansjoerg

    Your observation seems to be right because it was not the first time I recognized this effect. However, it is bitter to see that professional SW like Numbers can't hangle this option (password protection) correctly. It might have to do with the fact that the data file from Numbers is actually not a single file but a container with lost of files an subdirectories. Why the **** they make it so complex?
    Anyway, many thanks for your hint. I hope to find a tool which can correct those corrupted Number-files.
    Hansjoerg

  • Time Machine Deleting Files with 20Gbs Remaing

    Time Machine is starting to delete files when there is still 20Gbs remaining on the hard drive. Its a 500gb hard drive partitioned into two sections with 350gbs allotted for Time Machine. I understand that it deletes older files when its full but 20gbs remains hardly should be defined as full.
    Thanks
    Bryan

    Are you sure it's deleting them to make room for new ones, or doing it's normal "thinning" of expired backups?
    If it's deleted your oldest backup, then yes, that's because your TM disk is getting near full, as NeroWolfe explained.
    If not, it's just TM's normal process of deleting hourly backups after a day, and daily backups after a week.
    The easy way to tell is from your logs. Download the +Time Machine Buddy+ widget. It shows the messages from your logs for one TM backup run at a time, in a small window. Among all the other messages, every backup TM deletes will be identified, and it will be clear whether it's making room for new ones, or deleting expired backups.
    And even if it is deleting your oldest backups, TM will always retain it's copy of any item that's on any other backup and/or still on your internal HD. So your present system is always backed-up; all you lose is copies of things that were changed or deleted long ago.

  • How to open files with "return" key and delete files with "delete" key?

    Hi friends,
    It's been over a week since I got my iMac and I'm loving it. However, while I'm adapting alright to 'mac' key shortcuts (e.g. using the COMMAND-S for save as opposed to CONTROL-S used in PC).
    However, there are 2 things that are annoying me greatly right now.
    1. I like selecting files with keys as opposed to using the mouse. I make animations and prefer keyboard shortcuts. However, when I hit "return", instead of opening the file it goes into file-renaming mode. How do I change this? Likewise, I would like to delete files by hitting the delete key. This does not work - how do I change this?
    2. When I click SHIFT key sometimes, it gets 'stuck' - which is annoying because I start typing CAPITALS when I wasn't aware I've activated the CAP-LOCK key. How do I get rid of this? Like, I don't want to hit SHIFT for instance, and have that up arrow thing 'stuck' there.
    Your help would be greatly appreciated! Thanks!
    iMac G5   Mac OS X (10.4.9)  

    Hi
    Thanks for the star.
    If you went into Mac Help & searched, 2 results come up:
    Full keyboard access shortcuts for interacting with items (for selecting & activating controls).
    Full keyboard navigation keyboard shortcuts (for navigating Desktop, Windows, Menu bar etc)
    From the lists, select the link that closely describes your situation.
    I have to say that I can't reproduce your problem, does this happen just in applications or in everything? I don't know if it's to do with this but pressing Shift 5 times turns on Sticky Keys & Option(Alt) 5 times to turn on Mouse Keys (System Preferences>Universal Access>Keyboard).
    After typing "Sticky Keys" into Mac Help, I found this:
    "Pressing a group of modifier keys as a sequence
    To perform many tasks on your computer, you need to press one or more modifier keys (Shift, Command, Option, and Control) at the same time as another key. For example, pressing Shift-Command-Q in the Finder opens the Logout dialog.
    If you have difficulty pressing several keys at once, you can make it easier to press a set of keys by turning on Sticky Keys in the Universal Access preferences pane. With Sticky Keys turned on, you can press a set of modifier keys as a sequence. As you press each key, the symbol for the modifier key appears on the screen.
    Choose Apple menu > System Preferences and click Universal Access. Then click Keyboard.
    Select the On button next to Sticky Keys.
    To hear a sound whenever the computer registers that you have pressed a modifier key, select "Beep when a modifier key is set."
    To see an icon indicating which modifier keys you have pressed, select "Display pressed keys on screen."
    You can also use Slow Keys to adjust the amount of time between when you press a key and when it is activated."
    Any of this close to your problem?
    Steve
    Edit: I'm right, it's Sticky Keys:
    http://www.macusenet.com/190284-post2.html

  • Can not delete file with illegal character

    have a file with name of e}ail.txt
    can not delete it. Tried e*.txt, did not work.
    removed everything from the directory , renamed the directory to badDirectory , tried rm badDirectory /s /q
    and that didn't work.
    dir /X did not report an 8.3 file name.
    can not delete file or directory from FileManager either.
    went to a Linux box and did an smbfs mount. Still can not delete file.
    So, how does one delete a file with a openface curly bracket in the name?
    TechNet

    odder and odder:
    R:\rem>move badDirectory \junk\
    1 dir(s) moved.
    R:\rem>cd \junk
    R:\junk>rd \\.\r:\junk\badDirectory
    The directory is not empty.
    R:\junk>rd \\.\r:\junk\badDirectory /s /q
    \\.\r:\junk\badDirectory\e}ail.txt - The system cannot find the file specified.
    \\.\r:\junk\badDirectory\email.txt.bak - The system cannot find the file specified.
    R:\junk>dir badDirectory
    in drive R is f drive
    Serial Number is 58E7-B426
    Directory of R:\junk\badDirectory
    12/17/2014 02:41 PM <dir> .
    12/17/2014 02:41 PM <dir> ..
    08/30/2012 08:54 AM 68,719,477,275 e}ail.txt
    10/05/2011 11:11 AM 488 email.txt.bak
    2 File(s) 68,719,477,763 bytes
    2 Dir(s) 2,236,207,104 bytes free
    </dir></dir>
    The file e}mail.txt is not nearly that large, more like the size of the bak file. And when I try to use character completion type e} I get type e}badDirectory
    TechNet

  • Dupekill - delete files with duped data (2012-06-13 update)

    A few years ago, a friend and I had gotten a hold of a game's audio ripped directly from the disc. It included thousands of files that made up the game's sound, and many of the files sounded the exact same. We set out to pare this massive set of files down to something more manageable, with Python on our side. Thus, dupekill was born. When we first made it, it didn't recurse and was basically hacked together. I spent all of last night and most of this morning tweaking it for Python 3 and tried to turn it into a flexible console app/module.
    dupekill will (by default) search the current directory for files with duplicated data and get rid of them. It accepts -h (help), -r (recursive), and -v (verbose) flags, which are obvious, and a path.
    In addition, I added a "dry run" (-d) flag, so you know what will happen before you commit to getting rid of dupes. Without further delay, here it is:
    https://github.com/sporkbox/dupekill
    AUR Project Page
    It's my first Python 3 app and the closest I've come to a truly useful piece of software.
    Comments and suggestions welcome.
    UPDATE (2011-11-04)
    dupekill v1.3 is out. I followed keenerd's optimization suggestions to make it run better. Next on the list is an AUR package.
    UPDATE (2012-06-12)
    dupekill 1.5 supports ignoring symlinks with `-i`. Also available in the AUR.
    UPDATE (2012-06-13)
    dupekill 1.6
    ignores device and character nodes as well as sockets and FIFO pipes.
    `-a` and `-v` will now display the file that a dupe is a copy of, or the original file that a symlink clashes with.
    Last edited by xelados (2012-07-25 17:43:49)

    keenerd wrote:
    This sha256 sums every file.  That could be quite slow.  For example:
    time find /{bin,opt,sbin,usr,lib,lib32,lib64,boot,etc} -xtype f -print0 | xargs -0 NNNsum > /dev/null
    sha256sum - 153 seconds (user)
    md5sum - 44 seconds (user)
    head -c 512 - 2.5 seconds (user)
    ls -l - 5.6 seconds (user)
    User time ignores IO, but I ran all on cold caches to be safe.
    Some suggestions for optimizations:  first stat the files and get the total size.  If the sizes match, then read and compare the first 512 bytes.  If those match, then md5 the files.  If those match, then sha512.  (While head looks like a fast operation, comparing the 512 bytes is not, so it goes after the size.)
    edit, added stats
    If I understand correctly, the idea is to only use up resources when needed, correct? If two files are of a different size, then obviously their contents will differ, for instance. I tested dupekill on my music collection and it surely took a little while. I imagine checking simpler things would improve the speed of the system. Thanks for the suggestion! I'll see what I can do to introduce something like that in the next version.
    Last edited by xelados (2011-10-19 11:40:15)

  • Problems deleting files with OSX 10.8.3

    Since updating my 2009 MBP to 10.8.3 I am asked for the admin password to delete files.  The files disappear, but are not sent to the trash or clear space on the hard drive. Now my MBP is running out of space on the start up disk.

    Just researched the fix for this and applied this and it seems to work:
    1. Go to Terminal ( Make sure your set up as Admin)
    2. Type sudo chown yourname .Trash
    3. Enter your admin password
    You may get a no such directory message
    Seemed to fix the problem

Maybe you are looking for

  • Can I create a dashboard layout on the fly?

    Hi all, I am trying to create a dashboard layout "on-the-fly" (dynamically). for example: I can create the following layout using MXML very easily: [CODE] <mx:VBox width="100%" height="100%" horizontalAlign="center"> <mx:Canvas id="dashboardCanvas" w

  • Yosemite OS 10.10 Broke Syncing of Contacts and Calendars

    I just upgraded to Yosemite 10.10 on my Mac Book Pro and now my iCloud Contacts and Calendar do not sync between my MBP, iPhone 6, and iPad. My iPhone is on iOS 8.1 and my iPad is on 8.0.2. I updated a contact on my iPhone today and the change didn't

  • How to create Webi Reports with SAP BW Objects

    Hi, I have no knowledge on creating webi reports with SAP BW Objects like (InfoCube, DSO, MultiProvider, Infoview, MasterData Infoobject). As per my understanding Webi reports can be developed with universe which is created on BEx Queries or OLAP BAP

  • Outlook won't close after iTunes update

    Any one else notice this after the last iTunes / Quicktime update? After the most recent iTunes update, Outlook 2003 will no longer close completely. It stays active in the systray (that's the bottom right of the screen with the time) even though it'

  • Connect By with too many rows

    Hello, I have a table of contracts. Each can have different intervalls of payment: M monthly, Q quaterly, Y yearly or E single payment. Now I want a select that shows all dates from begin to maturity (duration) when the collection of outstanding acco