How to delete the folder in ABAP

Hi all,
i am dowmloading one text file into a one particular folder using GUI_download function module. and whenever we are downloading the text files to that particular folder i have to check whether the folder is exist or not, if that folder is existing then i have to delete that folder and i have to put the text file into new folder.
Note: for Folder creation am using some OOPs concepts , so any body plz send me the code ASAP.
BALU.

http://help.sap.com/saphelp_nw04s/helpdata/en/dc/f1783fe3263042e10000000a114084/content.htm
http://javaalmanac.com/egs/java.io/CopyFile.html?l=rel
http://javaalmanac.com/egs/java.io/DeleteFile.html
http://schmidt.devlib.org/java/copy-file.html
try {
     File inputFile = new File("C:
test
fold1
abc.txt");
     File outputFile = new File("C:
test
fold2
def.txt");
     FileInputStream in = new FileInputStream(inputFile);
     FileOutputStream out = new FileOutputStream(outputFile);
     FileChannel inc = in.getChannel();
     FileChannel outc = out.getChannel();
     inc.transferTo(0, inc.size(), outc);
     inc.close();
     outc.close();
     in.close();
     out.close();
     boolean fileDeleteSuccess = inputFile.delete();
     if(!fileDeleteSuccess)
          System.out.println("File couldnot be deleted");
     else
          System.out.println("File deleted!!");
     } catch (FileNotFoundException e) {
     e.printStackTrace();
     } catch (IOException e) {
     e.printStackTrace();

Similar Messages

  • How to delete the folder from easy DMS

    Hi..
    How to delete the Folder once it is created in easy DMS? As i have all the access
    Also how to restrict user from deleting the document from DMS? (Delete document option restriction)
    I want all folder to be gets created with internal number range only.i have define the same for Doc type FOL.
    But when i first log-in into easy dms system ask me do i need to create the folder i clicked on yes and while saving it shows an error that only internal number range is possible.But actually number EDIPUBLICROOTFOLDER  is selected by default and unedited format

    Hi,
    How to delete the Folder once it is created in easy DMS? As i have all the access
    First delete all the DIR's inside the folder using delete button. Later you can delete the Folder.
    Also how to restrict user from deleting the document from DMS? (Delete document option restriction)
    You can control this using authorization objects in DMS.
    Hope this helps.
    Regards,
    Deepak Kori

  • How to delete the folder VOLUMES on the main drive?

    Leopard creates a folder called Volumes on the root with aliases to external hard disks. I can delete the folder but as soon as I connect to the local network server, the folder Volumes appears again with an alias to the hard disk in the server. How do I permanently delete this folder? My Dock grid list is totally ruined by this folder. I was used to 5 folders on the root. Now it's six and I don't want that. I never had this annoying folder and I didnt do anything except for the 10.5.4 update. I also have no file or folder sharing active. The Volume folder also (re)appears when I connect an external USB disk. pls help

    A problem I have with this folder is that although it is an alias, sometimes when I do file transfers (such as receiving large amounts of photographs via pando etc.), as well as downloading the file to the external drive, as I have instructed it, is stashes the same file in the "Volumes" folder, and over time it can really start to eat away at the disc space. (I only recently discovered this recently and was this able to free up about 12 GB of disk space). I am pretty sure this is abnormal behavior for this folder, but I don't have any idea where to look to find what the problem is. Any idea what might be causing this, and how I can stop it doing it? It isn't catastrophic, now that I know, because I can periodically go and clear it out, but the eroding disk space caused me lots of problems until I discovered that this is what was causing it.

  • How to delete the Folder from sql server 2008

    Hi all,
    I was trying to delete the folder from sql server 2008 with the below script
    DECLARE @path VARCHAR(256) -- path for backup files
    DECLARE @cmd VARCHAR(8000)
    DECLARE @folderName VARCHAR(256) -- filename for backup
    SET @folderName = + (CONVERT(varchar(10), GETDATE()-7, 112))  -- 7 days back date folder name
    SET @path = 'I:\Backup_Test\' + @folderName -- Folder path
    SET @cmd = 'del ' + @path -- Delete
    EXEC master..xp_cmdshell @cmd
    --Print @cmd
    This is not working it was asking the Confirmation (I:\Backup_Test\20100629\*, Are you sure (Y/N)? ) what will i do to the delete the folder.
    Thanks,
    Prasad R.

    I would notice   you that T-SQL does not play well to do things like that. Do not you want using .net language to delete folders?
    Old method is
    declare @HR int, @CFOLDER varchar(255),@FSO int
        set @CFOLDER='D:\folder\'
        EXEC @HR = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
        EXEC @HR = sp_OAMethod @FSO, null, 'DeleteFolder', @CFOLDER 
    Now regarding to your second question please examine xp_fileexist  system stored procedure
    CREATE FUNCTION dbo.fn_file_exists(@filename VARCHAR(300))
      RETURNS INT
    AS
    BEGIN
      DECLARE @file_exists AS INT
      EXEC master..xp_fileexist @filename, @file_exists OUTPUT
      RETURN @file_exists
    END
    GO
    -- test
    SELECT dbo.fn_file_exists('c:\a.txt')
    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/

  • How to delete the folder of My Favorites?

    Hi,
    I have created a folder of my favorites with wrong name, how can I modify the name or delete this wrong folder of my favorites?
    BR,
    Alexander

    Alexander911 wrote:
    Hi,
    I have created a folder of my favorites with wrong name, how can I modify the name or delete this wrong folder of my favorites?
    BR,
    Alexander
    Sorry about the earlier post.. If what you mean is 'Collection' then currently you can not delete it anyway..not even online.. Though you may be able to delete all the Places (Favourites) as mentioned above..
    --------------------------------------------------​--------------------------------------------------​--------------------------------------------------​--If you find this helpful, pl. hit the White Star in Green Box...

  • How to delete the messages in the purges folder?

    if the mailbox is enabled the single item recovery, then the messages would move from deletion folder to the purges folder After running the following script,
    Search-Mailbox dave -searchdumpsteronly
    -deletecontent
    so my question is how to delete the messages in the purges folder with some script or retention policy?
    Please click the Mark as Answer button if a post solves your problem!

    Thank you all,
    As the mailbox is enabled single item recovery.
    I just want to make the items neither in deletion folder, nor in purges folder.
    So I think there are two ways to achieve this.
    Method 1,disabled the single item recovery. then delete the items in deletion folder ,so it wouldn't enter to the purges folder, it just deleted permanently. then enable the single item recovery
    Method 2,delete the items in deletion folder,then the messages move to the purges folder, then delete the messages in purges folder.
    the Method 1 is not so good ,as it need to disable the single item recovery firstly, then enable  single item recovery .
    So I want to use the Method 2
    Please click the Mark as Answer button if a post solves your problem!

  • How to delete the WSDL folder in DS (t-code : WSADMIN)?

    Hi,
    Can anyone advise how to delete the WSDL files and folder in DS client 200, t-code : WSADMIN?
    We mainly use this Discovery system for our users to practice and now seem there are a lot WSDL files and folders which are not used anymore, then we like to delete some unused folders.  
    Please kindly advise.
    Thanks you very much.
    Urisa

    Please use tCode WSCONFIG and delete the variants that you do not want.

  • How to delete the photos in network folder while deleting photos in iPhoto?

    Hi,
    How to delete the photos in network folder while deleting photos in iPhoto?
    I have emptied the iPhoto Trash but the photos in network folder are still not deleted.
    In iPhoto Preferences, Advance, Importing, I have UNCHECKED "Copy Items to iPhoto Library."
    http://img.photobucket.com/albums/v432/philipcs/Screenshot2009-10-26at120221AM.p ng
    Please help. Thanks.

    iPhoto is a relational database management program and manages only items that it controls - items within its library - it does not and will not do anything with any photo that is not in the library except to delete photos from cameras after import - and this is not recommended
    You are running a referenced library and it is not recommended - it makes deleting photos more difficult as you are seeing, it makes importing photos more difficult and it makes replacing or upgrading hardware much more difficult
    LN

  • HOW DO I REMOVE AN ICON FROM THE DISPLAY WITHOUT DELETING THE FOLDER?

    How do I remove a folder icon from the display on the mac without deleting the folder?

    If it's in the Dock, drag it out. It'll disappear.
    If it's on the desktop or inside a folder, drag it to another location.
    (126419)

  • How do I delete a folder that I moved to Trash from my external backup drive when a virus was detected? Trash will not delete the folder.

    I have tried unsuccessfully to remove a folder from Trash. My anti-virus program (Sophos) detected a virus which had to  be manually removed. I tried (unsuccessfully) to find and remove the infected file. I moved the Folder from my external backup drive and placed it in Trash. Now I cannot get Trash to delete the folder. It asks me if I wish to delete "unlocked" or "all" items. Either selection does not delete the folder. I went to change the permissions to "read & write" and unlocked the folder, but it is still there. I tried to "move" the folder from Trash back to the external harddrive but it seems I can only "copy" it and not "move" it. I am afraid that by copying it, I will not have the folder in two locations (Trash & External HD).
    Would appreciate any suggestions and guidance on this. I hope that I have explained the problem clearly!
    Thank you!

    Before deleting it we should know more about this folder and its contents.
    If it is invected and is using other apps, or other apps are still using it, then it cannot be deleted in the normal manner.
    You might contact Sophos and ask them about it.
    If you are using TM or have a backup of your system before the infection occurred, then you can delete the item(s) in Trash, but there is the possiblity of system corruption and the need for a reinstall, if any of these files are necessary for the OS to work properly, even though they are infected.
    Sophos may not have been able to remove the infection from inside a file which is why they suggested manual removal.
    You might consider downloading and running ClamXav first and see if it can't do better than Sophos.
    All that being said, you can always remove the contents of the Trash using the terminal. Usually as administrator, or in some cases as root (su). Unless you are very familiar with the terminal I do not suggest doing this without some study.

  • How to delete the deployed composite in weblogic server 11g

    Can someone tell me how to delete the deployed composite in weblogic server 11g ?I'm facing an issue where the weblogic server is getting started and immediately after sometime the server changes to "Force shutdown"..When i checked the logs,there is an error in one of the composite i deployed..So now i wanted to delete the deployed composite?Please help ....
    Thanks

    Hi
    1. Deleting a domain will not hold any references. But make sure that under your user_projects/applications also remove the folder that matches with your domain. Basically under user_projects folder you will see 2 folders named applications and domains. When you create a domain say mySoaDomain, it will crate a folder with the same name under applications folder also with few files like em.ear. If you do this, then you can crate a new soa domain and use the same old name.
    2. NOW comes the most important thing. If you create a new SOADomain, at one point, you had to give details for soainfra and mds schemas. If you give your current existing db details (that was used for your old deleted domain), then you may still have the issues. Because the soainfra db may still have the instances for your old process.
    3. If you really want to have a full clean soa domain, here is what you do:
    a) Run rcu and drop the existing schemas for soainfra and mds.
    b) Run rcu again and create above schemas again.
    c) Now create SOADomain using config wizard and refer above clean rcu db and you are all set.
    3. Under your domain root folder, just searh for files named with your workflow and you should see the .jar location.
    Thanks
    Ravi Jegga

  • How do I delete photo ALBUMS from my iPHONE 4? I sync via icloud and I can not see any folders selected in itunes. I searched the internet and basically there is no one who has the answer to how you delete the iphone photo library and misc albums

    how do I delete photo ALBUMS from my iPHONE 4?
    I sync via icloud and I can not see any folders selected in itunes.
    I searched the internet and basically there is no one who has the answer (so far)
    to how you delete the iphone photo library and misc albums
    I have also had every iphone and I am not stupid.
    charles altman

    Replying to my own post - heh. I downloaded iExplorer (http://www.macroplant.com/iexplorer/) which allowed me access to the files on the phone and there was the phantom movie in the DCIM folder. Deleted it, and all is well - although I still have 0.65gb of Other in iTunes.....

  • How to delete a folder in Documents To Go.

    I've created a folder in Documents To called Song Lyrics. In that folder I have several 100 songs with lyrics. Now I want to delete the folder but there is no delete button. I can delete each song individually but that doesn't delete the folder itself. How can I delete the folder?

    I'm no expert when it comes to Docs To Go but I'm wondering if pressing and holding the folder for a second or two will bring up a Delete option. Just a thought.
    Cheers.  
    - If my response has helped you, please click "Options" beside my post and mark it as solved. Clicking the "thumbs up" icon near the bottom of my response would also be appreciated.

  • How to delete the duplicate data  from PSA Table

    Dear All,
    How to delete the duplicate data  from PSA Table, I have the purchase cube and I am getting the data from Item data source.
    In PSA table, I found the some cancellation records for that particular records quantity  would be negative for the same record value would be positive.
    Due to this reason the quantity is updated to target but the values would summarized and got  the summarized value  of all normal and cancellation .
    Please let me know the solution how to delete the data while updating to the target.
    Thanks
    Regards,
    Sai

    Hi,
    in deleting the records in PSA table difficult and how many you will the delete.
    you can achieve the different ways.
    1. creating the DSO maintain the some key fields it will overwrite the based on key fields.
    2. you can write the ABAP logic deleting the duplicate records at info package level check with the your ABAPer.
    3.you can restrict the cancellation records at query level.
    Thanks,
    Phani.

  • How to delete the saved score in a game downloaded from app store for my macbook and restart the game from the beginning ? please help

    HOW to delete the saved score in a game downloaded from the app store to restart the game from the begining with fresh scores.
    i am unable to do so. please help

    In system preferences, create a new account again, using the short name of the "deleted" account. You may be prompted to re-use the old home folder. Log out and log in to test it worked. Then log in as your new admin, and do the delete process again. Don't choose to securely delete this time - just a regular delete.
    When you have time to spare, go to Disk Utility, and use the Erase tab to securely erase free space on the drive. This will accomplish the same thing that your originally tried to do. Use the fastest method - anything more secure is a waste of time. You may need to run it overnight - it can take several hours.
    Matt

Maybe you are looking for

  • Firefox crashes on Start-Up

    Hello! I downloaded the latest version of Firefox for Windows XP but it always crashes on start-up. Mozilla Crash Reporter appears. I am not able to start Firefox in safe mode. My latest crash ids are bp-9fdcf812-70e4-4025-97b1-4c7592130430, and bp-7

  • How to read data from SAP database in java?

    Hi All , I want to read some tables from SAP database in java? How to connect to SAP database in java.I want to read the data from SAP NetWeaver BW 7.3. Please help..

  • Possible Scenarios where we can use OS command of file adapter

    Hi all, I would like to know the possible scenarios in which we can use the OS command feature in file adapter,I have tried zipping the file,copying the file,unzipping the file using this option.Any other inputs on this feature are appreciated. Thank

  • EXTERNAL HARD DRIVE CUTS OUT RANDOMLY

    Forum, While in working in FCP, my external hard drive (G-Raid 2) keeps cutting out - 3 times in the past few hours. I think it's a bad connection, but I'm not sure. Any tips? Thank you, Trey

  • Cannot activate a Form in the Form Builder

    Hello, I have a problem with activating a Form and I don't know the reason of this error. I get the following message after an activation in vain: SOAP Framework error: SOAP Runtime Exception: CSoapExceptionTransport : HTTP send returned with status