Unable to rename/delete a folder!

Hi Guys -
I am having problem renaming and deleteing any folder. The functions return false each time and no delete or rename is done. Can anyone spot what I am doing wrong? Here are the tow methods for this functionality:
public boolean renameFolder(String oldName, String newName) {
try {
boolean result = false;
Folder folderToBeRenamed = getFolder(oldName);
if (folderToBeRenamed.exists()) {
if (folderToBeRenamed.isOpen())
folderToBeRenamed.close(false);
result = folderToBeRenamed.renameTo(f1);
if (!result)
EL.writeError("UserStore: renameFolder: Error while renaming folder!");
else
EL.writeError("UserStore: renameFolder: Folder does not exists!");
if (result)
updateFolderNames();
return(result);
catch (Exception ex) {
EL.writeError("UserStore: deleteFolder: "+ex.getMessage());
return(false);
public boolean deleteFolder(String folderName) {
try {
boolean result = false;
Folder folderToBeRemoved = getFolder(folderPrefix+userFolderPrefix+folderName);
if (folderToBeRemoved.exists()) {
if (folderToBeRemoved.isOpen())
folderToBeRemoved.close(true);
result = folderToBeRemoved.delete(false);
if (!result)
EL.writeError("UserStore: deleteFolder: Error while deleting folder!");
if (result)
updateFolderNames();
return(result);
catch (Exception ex) {
EL.writeError("UserStore: renameFolder: "+ex.getMessage());
return(false);
Thanks guys! I'll look forward to your comments!

Hi there,
I am able to create a folder. But when I try to delete the folder it gives error like "can not delete default foder ".
I reuires help from u guys.
I have following doubts.
-how to list down all the folders.
- how to delete a folder
-how to rename a folder
your suggestions & code are most welcome.
If u have any code regarding this please semd/forward it at "[email protected]"
Thnx 4 ur help.

Similar Messages

  • Error Renaming/Deleting a folder!

    Hi Guys -
    I am having problem renaming and deleteing any folder. The functions return false each time and no delete or rename is done. Can anyone spot what I am doing wrong? Here are the tow methods for this functionality:
    public boolean renameFolder(String oldName, String newName) {
    try {
    boolean result = false;
    Folder folderToBeRenamed = getFolder(oldName);
    if (folderToBeRenamed.exists()) {
    if (folderToBeRenamed.isOpen())
    folderToBeRenamed.close(false);
    result = folderToBeRenamed.renameTo(f1);
    if (!result)
    EL.writeError("UserStore: renameFolder: Error while renaming folder!");
    else
    EL.writeError("UserStore: renameFolder: Folder does not exists!");
    if (result)
    updateFolderNames();
    return(result);
    catch (Exception ex) {
    EL.writeError("UserStore: deleteFolder: "+ex.getMessage());
    return(false);
    public boolean deleteFolder(String folderName) {
    try {
    boolean result = false;
    Folder folderToBeRemoved = getFolder(folderPrefix+userFolderPrefix+folderName);
    if (folderToBeRemoved.exists()) {
    if (folderToBeRemoved.isOpen())
    folderToBeRemoved.close(true);
    result = folderToBeRemoved.delete(false);
    if (!result)
    EL.writeError("UserStore: deleteFolder: Error while deleting folder!");
    if (result)
    updateFolderNames();
    return(result);
    catch (Exception ex) {
    EL.writeError("UserStore: renameFolder: "+ex.getMessage());
    return(false);
    Thanks guys! I'll look forward to your comments!

    I've never tried renaming a folder but here is the class I use to delete one and move its contents to a deleted items folder.
    =================================
    import java.util.*;
    import java.util.Properties;
    import java.net.*;
    import java.io.*;
    import java.lang.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class EmailDeleteFolder06 {
         String timeoutVal = "5000";
         public String deleteFolder(String url, String srcFolder, int timeout) {
              String timeoutVal = "" + timeout;
              return deleteFolder(url,srcFolder);     
         public String deleteFolder(String url, String srcFolder) {
              String destFolder = "Deleted";
              return movemessages(url,srcFolder,destFolder);
         private String movemessages(String url, String srcFolder, String destFolder) {
              String messageString = "Folder Deleted<br>(The messages in this folder have been moved to the Deleted folder.)";
              Properties props = System.getProperties();
              props.put("mail.imap.connectiontimeout",timeoutVal);
              props.put("mail.imap.timeout",timeoutVal);
              Session session = Session.getInstance(props,null);
              Store store = null;
              Folder sourceF = null;
              Folder destinationF = null;
              try {
                   URLName urln = new URLName(url);
                   store = session.getStore(urln);
                   store.connect();
                   sourceF = store.getFolder(srcFolder);
                   destinationF = store.getFolder(destFolder);
                   sourceF.open(Folder.READ_WRITE);
                   destinationF.open(Folder.READ_WRITE);
                   Message[] msgs = sourceF.getMessages();
                   sourceF.copyMessages(msgs,destinationF);
              } catch (Exception moveF2) {
                   moveF2.printStackTrace();
                   messageString = "An error occured while deleting the folder.";
              try {
                   sourceF.close(true);
                   destinationF.close(true);
                   sourceF.delete(true);
                   store.close();
              } catch (Exception closeExc)
                   closeExc.printStackTrace();
                   messageString = "An error occured while deleting the folder.";
              return messageString;
    }

  • ITunes deletes symlinked folder on Album Artist rename

    Hello community,
    I experience a very strange behavior of iTunes in combination with Symlinked folders. I use Windows 7 and my folder structure is listed below. I have a Laptop with a 256GB SSD and instead DVD-Drive a 640GB SATA drive.
    Drive layout:
    C: System (Windows Drive)
    D: UserProfile (also symlinked to D:\Username
    E: Media
    My iTunes DB is about 170GB large including media of all kind. I spread the iTunes Media subfolders among several drive, because I want iTunes to start up very fast, but playing music and syncing my iPhone would not benefit from the fast SSD Drive so I don't want to waste the valuable fast space.
    Now when I change the Album Artist of an album iTunes kills/deletes my Music symlink folder after completing the first rename and show the rest of the album as missing files (with the ! in front)
    I have discovered that this only happens when iTunes tries to rename/move folders like it does if the Album artist is changed.
    I have already tried restricting the permission to the symlinked folder to read even with deny write permissions, but it manages to delete the folder everytime.
    I have used a folder junction instead also. All without joy.
    The owner of the folder is the Administrators group which my user is a member of. There are several reason I cannot work a a regular user and I do not want to change that.
    So did anyone experience this and knows why this is the case? I would be glad to know. Thanks for everybody investing a thought
    Sorry for this text monster, but this really bugs me.
    Best regards Bruce
    P.S. Maybe Apple will here my whining and look into this behavior also.
    +Directory of C:\Users\Username\Music (actually D:\Username\Music)+
    +2010-09-28 13:12 <DIR> .+
    +2010-09-28 13:12 <DIR> ..+
    +2010-09-27 16:43 <SYMLINKD> iTunes [d:\iTunes]+
    +0 File(s) 0 bytes+
    +3 Dir(s) 146,808,844,288 bytes free+
    +C:\Users\Username\Music>dir itunes+
    +Volume in drive C has no label.+
    +Volume Serial Number is B022-C44F+
    +Directory of C:\Users\Username\Music\itunes+
    +2010-10-02 23:41 <DIR> .+
    +2010-10-02 23:41 <DIR> ..+
    +2010-10-02 23:41 <DIR> Album Artwork+
    +2010-10-02 23:41 1,007,616 iTunes Library Extras.itdb+
    +2010-10-02 18:33 72,208,384 iTunes Library Genius.itdb+
    +2010-10-02 23:32 5,963,887 iTunes Library.itl+
    +2010-10-02 23:30 29,777,149 iTunes Library.xml+
    +2010-10-02 23:29 <DIR> iTunes Media+
    +2010-09-27 16:45 <DIR> Previous iTunes Libraries+
    +4 File(s) 108,957,036 bytes+
    +5 Dir(s) 146,808,844,288 bytes free+
    +C:\Users\Username\Music>dir "itunes\iTunes Media"+
    +Volume in drive C has no label.+
    +Volume Serial Number is B022-C44F+
    +Directory of C:\Users\Username\Music\itunes\iTunes Media+
    +2010-10-02 23:29 <DIR> .+
    +2010-10-02 23:29 <DIR> ..+
    +2010-09-27 16:07 <SYMLINKD> Audiobooks [e:\iTunes\iTunes Media\Audiobook+
    s]
    +2010-09-27 16:03 <DIR> Automatically Add to iTunes+
    +2010-10-02 21:53 <DIR> Downloads+
    +2010-10-02 23:14 <DIR> Mobile Applications+
    +This folder gets deleted.+
    +2010-10-02 23:29 <SYMLINKD> Music [e:\iTunes\iTunes Media\Music]+
    +2010-09-27 16:08 <SYMLINKD> Podcasts [e:\iTunes\iTunes Media\Podcasts]+
    +2010-09-27 16:03 <DIR> Ringtones+
    +2010-09-27 16:09 <SYMLINKD> TV Shows [e:\iTunes\iTunes Media\TV Shows]+

    Hi, welcome to Apple Discussions.
    iTunes and symlinks don't play nicely... They work OK as long as iTunes is only reading data but get all confused when iTunes tries to write back. I recommend you just put the whole library on a drive big enough to hold it all in one go.
    tt2

  • WebDAV: delete or rename of a folder doesn't work in XP clients

    Hello!
    I provide file sharing via WebDAV to some Windows XP clients.
    The clients can create files and folders, but they can't rename folders (renaming files does work).
    When I mount the WebDAV-Folder in MacOS, renaming folders does work perfectly. I can see a difference in the MOVE command in the apache log: MacOS sends a trailing slash, XP doesn't. This results in an error on XP.
    The same behaviour is true for deleting a folder - doesn't work also.
    Does anybody know a solution? Dows it worl for your setup?
    Thanks & best regards,
    Steve.

    Thanks cor-el,
    That's exactly what I've done - by accident, clearly!
    Ah well, panic over...
    Thanks again,
    Si

  • Thunderbird: Email contents display as blank after renaming or deleting a folder

    After deleting or renaming an email folder we find that, on choosing another folder, all email is blank. That is the headers are displayed correctly but on clicking these to view the message body the lower panel is entirely blank. This applies to all subsequent folders selected.
    On closing and re-opening ThunderBird the folders and email display correctly again.
    We wound back to an earlier version and the problem does not exist. Have switched off updating.
    Does anyone have any ideas?
    Details:
    We have this problem with version 28.X to present, including Betas.
    No problem with version 24.X and earlier.
    imap using Dovecot 2.2.10 on Centos 7.0.1406
    Many thanks,
    Ewan Crawford

    Dear Matt,
    Very many thanks indeed for your quick reply. We have tried that, but no luck I'm afraid. Only closing and re-opening Thunderbird gets round this problem.
    I am aware that the page
    http://kb.mozillazine.org/Disappearing_mail
    advises closing and re-opening, but we'd like to avoid this if possible.
    Best wishes,
    Ewan

  • Deleted Items Folder renamed, how do I get it back.

    I have user who was dragging e-mails from her inbox to deleted items. So how, one of the subjects of the e-mail is now her deleted items. In otherwords the deleted items now has another name and I have no idea how to rename it back. Any ideas? First for
    me.
    Thanks
    Mike

    Hi,
    I would like to ask
    whether the Deleted Items folder is renamed, or one of the deleted emails in the Deleted Items folder is renamed.
    If it is the Deleted Items folder, we cannot rename or move or delete the default folder in Outlook, try start Outlook with this switch:
    /resetfolders.
    If not work, try create a new Outlook profile.
    Also, try to scan viruses.
    Regards,
    Harry Yuan

  • Unable to delete a folder under Artists and albums...

    Hi..Im not able to delete a folder under Artists and albums in the music player. When deleting im getting msg as "File is Corrupted. Operation Cancelled". Can somebody suggest me how to get rid of the folder??

    Connect phone to computer with usb cable (select mass storage mode) and try to delete folders using computer's file manager.

  • I'm unable to delete a folder on my OS X 10.6.8 iMac...

    I have a folder on my startup drive that will not delete. I can issue the command "rm -rf dir_7171197" as root, and the prompt comes back with no errors, but the folder is still there.  My question is, what are the reasons a file is not able to be deleted?  I can change the name of the folder  but I can't move the folder into the parent, and I can't put it in a child folder.  If I attempt to trash the parent, it just sits there in the trash can and never deletes.  There are no additional attributes assigned to either the folder itself or the parent.

    Here are the facts:
    /Macintosh HD/delete-me is where the folder aaa is that can't be deleted.
    The permissions on the folder to delete is:
    imac24:delete-me root# ls -ld aaa
    drwxrwxrwx  2 mercylife  wheel  68 Aug 11  2011 aaa
    imac24:delete-me root#
    The delete-me folder has the following privs:
    imac24:Macintosh HD root# ls -ld delete-me
    drwxrwxrwx  4 mercylife  wheel  136 Mar 21 23:54 delete-me
    imac24:Macintosh HD root#

  • Error: Mail was unable to rename ....

    I have a few mailboxes in On My Mac that contain a couple of levels of subfolders. I'm not having any trouble accessing messages in these mailboxes, but when I try to move or rename some of these folders I get an error message that says I'm unable to rename the mailbox. If I try to rename "Mailboxname" to "OtherName", for instance, I get the message:
    Error: Mail was unable to rename "~Library/Mail/Mailboxes/Personal/Saved Mail/Archive/Mailboxname
    While the error dialog is present, the display name of the folder in the sidebar changes to:
    Mailbox "OtherName" does not exist
    When I dismiss the error, the mailbox name reverts to Mailboxname.
    Another oddity, sometimes, I'm unable to delete existing mailbox. I right click on them, select Delete Mailbox, confirm the deletion when prompted, and the mailbox is still there.
    Any suggestions for how I can address this?
    I've tried rebuilding the mailboxes that can't be renamed, and I've run the vacuum command in Terminal, but nothing seems to resolve the issue.

    My guess is that Folder 1 was seen as a white folder Icon in the Sidebar, before and after subfolder 1 went missing. As a white folder, Mail could see the items apparently still contained within it. Recreating the subfolder somehow allowed the display of content from the Messages folder, that apparently survived the previous delete operation. We would have been able to go into the Finder and see this, I think, but I also think you are very lucky.
    Ernie

  • Unable to rename objects

    In the OMWB, I am unable to rename objects. For example, in the Source Model under the Views folder, I have a view whose name is 100 characters long. I want to rename it to a 30 character name (something meaningful and not system generated.) The on-line help says to use the menu to click on Object > Rename, but that is grayed-out. The only available options are delete and parse. Both of those work, by the way.
    I just downloaded and installed OMWB last Thursday, so this is latest version of software. I also got the SQL Server 2000 plug-in, and it's installed correctly because I have been successful at migrating SQL Server 2000 to Oracle 10g.

    Hi Mark,
    You are quiet correct. The OMWB does not allow you to rename schema objects in the Source Model. The only objects which can be renamed manually are tablespaces and users in the Oracle Model.
    The workaround is to rename the view inside the Oracle Model PL/SQL editor. Then your view with get generated with the choosen name.
    I have found the following in the OMWB help
    "You can customize the Oracle Model by: Creating, deleting, and renaming objects "
    This will be logged as a bug as not all objects can be renamed. Could you provide a link to the on-line help document which states "click on Object > Rename" as I am having difficulty finding it, and I will add this to the bug report.
    Regards,
    Dermot.

  • Unable to rename white folders

    I'm unable to rename the white folders of an IMAP account.
    I can rename white folders "On My Mac" and I can rename all blue folders. I just can't rename the white folders of an IMAP account.
    I get the following error:
    Error
    The IMAP command "RENAME" (to new folder name) failed with server error: Mailbox does not exist.
    Any ideas?

    Create new folder with correct name, move contents from old folder into new folder and delete old folder.

  • Unable to rename folders and files on SharePoint mapped drive.

    I just installed a fresh copy of Windows 7 and have mapped a drive to my SharePoint "Shared Documents" folder.  I am able to open, save, and delete files and folders.  However, I am unable to rename files and folders.  No matter how long of
    short of a name I use I get the following error:
    "The file name you specified is not valid or too long.  Specify a different file name."
    I've mapped the "S" drive to http://hostname.domain.com/Shared Documents/
    I am a SharePoint Admin, and have confirmed that if I do not have this problem if I log into SharePoint with IE.  I have also confirmed that others are not experiencing this issue. Also, this issue did not exist on my previous installation of Windows
    7.  Therefore I assume this is a config issue.
    Also, in "My Computer" it shows the mapped SharePoint drive as a "FAT" filesystem.

    Did some more testing. From my mapped drive, I can create new folders and files, and delete them.  I created a folder in Windows Explorer, when I tried to give a name it gave me the above error and saved the folder as "New Folder".  No matter when
    I try, I cannot rename this folder unless I log into the SharePoint interface.
    Next, I tried this from the command line.  I moved to my S drive, and did a "mkdir test" and was able to create a folder named test.  Next I tried to "rename test testing" and received the following error:
    The filename, directory name, or volume label syntax is incorrect.
    The full path is S:\test.  If I do a "mkdir testing" I am able to create the folder.  If I try to rename the folder in Explorer, it gives me the "file name not valid or too long".  I'm obviously well under the 260 character limit, so there
    has to be something wrong with the fiel name, or drive mapping.
    Also, when I "dir" the S drive it tells me the drive has no label.  "Volume in drive S has no label."
    I'm having the same issue with files. I can create a file, modify it, delete it, but can't rename it.

  • I renamed my home folder :( can't get it back to normal

    hi, i know there are about a billion topics in this forum about this same thing, but i still cannot get everything back to normal despite reading a lot of them.
    a couple of weeks ago i renamed my home folder, which created a whole new set of preferences.
    i've done some things since then, but i can't remember every step i've taken so bare with me! maybe you clever people can figure out what i've missed out/done wrong.
    i remember that in the users folder i renamed the new (incorrect) folder to Stephen_new, and changed the old (correct) one to Stephen. - this was as instructed to by http://docs.info.apple.com/article.html?artnum=107854.
    I also copied the whole library folder from the home > Stephen > library to the home > library folder, as instructed on step 3 on this website http://www.thexlab.com/faqs/renamehomerecovery.html (i presumed by 'home > library > library they meant home > Stephen > library). This gave me back my bookmarks and stuff.
    however, in the home folder there was only library and desktop. now, when i add something to a folder (say movies) through mac hd > users > stephen > movies (or the shortcut on the left of finder) it creates a new movies folder in the home directory, and copies the file there too. i.e. the file is in 2 places.
    also on the left of finder the icons for movies etc. have all gone back to blue folder icons.
    so basically the problem is before if i wanted to go to documents it would be right in my home folder, but now i have to go mac hd > users > Stephen > documents to get there, or i could make a shortcut on the left of finder.
    i'm not sure how to tell which users folder i'm actually using, Stephen or Stephen_new. I'm guessing it's Stephen as new files seem to save there.
    i would guess that i need to change my users folder to the name of my home folder icon, but you can't have 2 things the same name in the same folder.
    i created a topic at appleinsider.com's forums, which no one replied to. maybe some of the info there could help you figure it out
    http://forums.appleinsider.com/showthread.php?t=71584
    thank you very much for any help you can give me. if anything is unclear please ask me to explain further.
    ibook g4   Mac OS X (10.4.8)  

    hello again,
    i didn't really dare to delete the blue home folders before, just in case everything went wrong, but now i think i have so little space that i can't afford to lose 2.25gb!
    one thing that slightly worries me is the fact that the 'proper' library folder (in the home icon) is 2.09gb, whereas the 'wrong' one (from the blue folder forenamesurname) is 2.24gb - this is the one i would be deleting. just seems odd to delete a larger file than the one i presume i'm using.
    "Move everything you want to keep out of the blue folders, and then place both of the folders on your desktop. If everything works properly after a few days, delete both folders. If you are asked for your administrator password at any point or if either folder is copied instead of moved when dragged, don't delete that folder."
    by 'everything you want to keep', does this include the library folder? 'cause there doesn't seem to be much else, and i'm not sure if deleting the library folder would ruin all my preferences.
    i've put both of the folders on the desktop, it didn't ask for the admin password or try to copy them, so i guess that's good news. what kind of things should i be looking out for to act differently?
    are the folders not in use now that they are on the desktop?
    also if i put them in the trash will they have no effect? i.e. the same as permanently deleting them, so i could put them in the trash as a test.
    cheers, stephen.

  • Warning when trying to delete a folder

    Hi
    I am getting the following warning message when I try to delete a folder. The delete button is active and when I hit the delete button a confirm message pops up. When I confirm the delete I get the following warning message and the folder does not get deleted.
    "<<<< Unable to modify target configuration because it is set as final. >>>>"
    Please note: I am able to delete the files in the folder. The issue is only with the folder itself and all folders within this folder.
    Any help is highly appreciated.
    Thanks and Regards
    -- Venu RR

    Hi Matt
    Thanks for your prompt reply.
    If a folder inherits policies from the parent folder and if the parent does not allow subfolders to override the policies, is it impossible to delete the folder?!!
    Please find below the details requested by you: -
    I am using Content Services 10.1.2.0.0
    The policy configurations for the folder I am trying to delete are: -
    Sharing
    Inherit Settings
    Group: All Site Users, Access Roles: Administrator, Author, Reader
    It is set to FINAL
    Versioning
    Inherit Settings
    Set to Auto Versioning
    Auto Labeling Enabled
    Labeling Format : 1.0, 2.0, 3.0 ...
    It is set to FINAL
    Categories
    Inherit Settings
    Category "Service Request File" required
    It is set to FINAL
    Workflow
    Operation: Delete
    Inherit workflow settings from parent folder
    It is set to FINAL
    Serial Approval WF
    Skip WF if submitted by an approver is SET
    Justification is a mandatory parameter
    Thanks and Regards
    - Venu

  • Renaming a file / folder

    hi all,
    how to rename a file/folder automatically when executing java program application.. and also that renamed file should not be editable like delete,open,copy,rename manually in the specified location where the folder is.
    i have used renameTo method but the folder is still editable.
    plz suggest this,

    You need to set the permissions on the file.
    In pure java you can set the read and write permissions using File but for OS specific permission you need to run the approriate command line program to set your permissions.

Maybe you are looking for