How can i zip without full path?

I zip a file with this servlet, but when i unzip the file, it save my file with a full path... how can i do? thanks
CODE
import java.io.*;
import java.util.zip.*;
public class ZIPFILE
public String DOPOSTPROCESS(String filename)
FileOutputStream fileout = null;
byte[] buf = new byte[1024];
try
File f1 = new File(filename);
File f2 = new File(filename+".zip");
String fileoutname=filename + ".zip";
fileout = new FileOutputStream(fileoutname,false);
ZipOutputStream out = new ZipOutputStream(fileout);
// Compress the files
FileInputStream in = new FileInputStream(filename);
// Add ZIP entry to output stream.
out.putNextEntry(new ZipEntry(filename));
// Transfer bytes from the file to the ZIP file
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
// Complete the entry
out.closeEntry();
in.close();
// Complete the ZIP file
out.close();
f1.delete();
f2.renameTo(f1);
catch (IOException e)
try
catch(Exception e1)
return("Errore CR2CRLF "+e);
return null;
}

If the path name consists of one or several directories and then by the file name, you could use only the file name portion for the insertion into the zip archive.

Similar Messages

  • How can I show the full path in terminal?

    By default I only see the current folder
    How can I toggle it so that I see the full path instead?
    I say toggle - I'd like to switch on and off
    Thanks
    Omar

    @arthur, awesome! thats better than what i was trying to do!
    i only wanted to get the path so that i could cd to it
    but then i have to add quotes around because of spaces
    the method u suggested escapes all required chars and means i can just type cd and then drag the folder and then press enter
    @barney: super helpful - i need to re-remember my unix commands. lol

  • How to read file WITHOUT full path using TEXT_IO?

    We have a scenario like this:
    -- We have a Telco application.
    -- That has 3 types of installations. English and Spanish
    -- We have 2 App Servers (Eng & Spa) for the 2 installation types.
    -- But there is only ONE DB. I.e. users logging into Eng or Spa AS versions login to the same DB.
    -- We have to maintain 2 login forms because of Eng and Spa, because the menu labels have to come in 2 langs.
    -- I am trying to have one tree menu for this.
    -- To do this I did this.
    -- Put a text file in the Forms directory of the AS.
    -- The file has just one line. ENGLISH or SPANISH.
    -- I read this file and find out the language and then show labels according the language.
    Problem is that when I used TEXT_IO and gave file name like this filename:=GET_FILE_NAME('Avabill_AS_Language.txt', File_Filter=>'Text Files (*.txt)|*.txt|');
    I get a error saying file not found.
    I found out that with TEXT_IO you need FULL PATH of the file. Thing is path of the installation depends of installation to installation. I cannot create a parameter in the DB since the DB is COMMON. I HAVE TO use a text file in the AS directory.
    Is there any other way like reading the Default.env file or FormsWeb.cfg? Is there a parameter in any of these files which specifies the forms directory absolute path. I studied both file but could not find an entry.
    Any workaround would be greatly appreciated.

    Thanks BaiG for the quick response.
    U r right about that GET_FILE_NAME.
    I removed that and put the file name only and tried. Still get the same error.
    FUNCTION Avabill_Deployment_Type RETURN VARCHAR2 IS
    v_language VARCHAR2(100);
    in_file Text_IO.File_Type;
    BEGIN
    in_file := Text_IO.Fopen( *'Avabill_AS_Language.txt'* , 'r');
    Text_IO.Get_Line(in_file, v_language );
    Text_IO.Fclose(in_file);
    RETURN v_language;
    EXCEPTION
    WHEN OTHERS THEN
    Text_IO.Fclose(in_file);
    ALERT_MESSAGE(1,'FILE NOT FOUND: ' || SQLERRM);
    RETURN 'Normal';
    END;
    I get this error:
    *302000: non-ORACLE exception*
    As for you query:
    -- We have 2 app servers. One English and One Spanish.
    -- So we have 2 sets of forms. One English with English labels in the forms and the other with Spanish Labels.
    -- So we HAVE to have 2 menu forms as well, don't we? When the menu form is run how does it know whether the app server is English or Spanish.
    -- There is no way to find out. We cannot use a DB variable since BOTH use the same DB (at the same time). Eng users will enter in English while Spanish users will enter in Spanish.
    I don't see how we can have one menu form for this purpose. Can u elaborate your method further please?

  • How can I paste the full path name into the find file dialog?

    I've copied a full path name using CMD-C.
    Now I click on a link in some web page (does not matter which one) which lets me upload a file.
    The standard apple file selector dialog pops up (sorry don't know the official apple name for this dialog), to let me navigate and select the file.
    How can I paste the file name?  Or how can I tell the dialog popup to navigate to the file whose full path name is in the clipboard?

    Here is an image showing the file browser dialog I'm referring to.

  • How can I determine the full path and filename of the currently opened .ai file?

    In Photoshop, right clicking the file name of the opened file in progress shows an option "Reveal in Explorer" so I know exacly where the file was opened from.
    In Lightroom, it is displayed in the metadata.
    New to illustrator, I have looked at loads of menu options get cannot see how to find this information.
    Would be grateful for some help.

    +1 for what Larry said if you are on OS X. You can then scroll through and select any of the listed items and when clicked upon it will take you to that folder/location.
    Not that it would offer ease of use or a better method, but you could also use a simple script to retrieve this info as another alternative method:
    Example Structure:
    alert("File Path/Location:\n" + File.decode(app.activeDocument.fullName));
    Results the Below Alert:
    alert("File Path/Location:\n" + File.decode(app.activeDocument.fullName).split('/').join('\n/ '));
    Results the Below Alert:
    But again, not that this approach would offer ease of use or a better method, just another alternative method (It works in my quick tests).

  • How can I view my full billing history for the app and music stores without iTunes installed?

    I just received an email receipt from Paypal showing a $12.99 purchase from iTunes. I almost NEVER purchase anything over around five dollars in the app or music store. Since PayPal does not show what this purchase was for, I have not received the receipt from Apple yet, and I cannot find anyway to look up online what this purchase was for....I need help to find out ASAP what this purchase was. If my account has been compromised or if I have been incorrectly charged for something, I would like to get the issue handled immediately. I do not want to install iTunes on my PC (nor should I have to for Pete's sake), but I cannot see anything recent at all in my app or music history on my iPad (not that I would ever purchase anything for $12.99 anyway...I just don't). Thanks in advance for any tips!

    How can I view my full billing history for the app and music stores without iTunes installed?
    No.
    If my account has been compromised
    If you even think this may have happened, immediately change your password.
    See this -> Apple ID: Changing your password

  • How can I create a full page on Adobe Muse (without side space)?

    How can I create a full page with Adobe Muse (without side space)?

    Muse uses Fixed width Layouts so that is not 100% possible. You can extend images and box elements to full width but not actual content.

  • How can i change the full download and install path because my C: ist full and it automaticly downloads it on C: i allready changed in on adobe creative cloud but it dont work

    How can i change the full download and install path because my C: ist full and it automaticly downloads it on C: i allready changed in on adobe creative cloud but it dont work

    Read the part about SSDs. Otehrwise there is nothing you can do. Certain components wil lalways install on your system root drive.
    Mylenium

  • How do I see the full path in Yosemite's spotlight?

    How do I see the full path in Yosemite's spotlight? (cmd shows only partial path)
    Seeing the full path would make work much easier finding my articles which I have put in distinct catalogues.

    CazooMAC,
    Holding ( Command ) to show the path of a file that is displayed at the bottom of the preview pane in Spotlight is the only way to display the path in the Spotlight app its self.
    If you hold ( Command ) and double click the item you are looking to get a path of it will open that items containing folder in Finder. From there you can get the full path using a bunch of different methods. An Example would be using Finders Get Info option. The Keyboard shortcut is ( Command ) ( I ).
    There is another thread that covers the topic of getting a clean path in Finder. Or basically a path that one doesn't have to type out manually, without those little arrows in between folders. It can be found here: How to get a clean file path in OS X Yosemite?
    My Suggestion to get a clean path there is as follows:
    Another way you can get the path, and yes I'm aware its cumbersome, is you can open the "Go to Folder" window and drag your folder or file into it and it will give you the path. Free of modifiers and without opening another application.
    I find it works best if when you start there is no Finder windows open. If you leave one open you just have to open another one as it doesn't let you drag and drop from the one with the "Go to Folder" window in it.
    Finder has to be Active > Select Go ( Menubar ) > Go to Folder...
    Or you can use the keyboard shortcut ( Command ) ( Shift ) ( G )
    At this point I like to clear out the address field as if there is anything in there it will stay.
    Next Open a new Finder window.
    Examples on how to: Select File > New Window, or the keyboard shortcut ( Command ) ( N )
    Find the File or Folder your interested in then drag and drop it in the Address Field of the "Go to Folder" window and it will give you the path.
    If you would like to send Apple feedback about this you can do so here: https://www.apple.com/feedback/macosx.html
    Hope that helps,
    Weston

  • How can i get a full url of video uploaded in asset library on sharepoint 2013

    Hi All,
    I have videos in SharePoint 2013 Asset Library, now i want display that videos in my SharePoint webpage as a webpart.
    Now, how can i get a full url of video uploaded in asset library?
    Thanks in Advance!

    The Asset library does a pretty good job of hiding the full URL. An "asset" item is actually a folder. The folder contains the video and support files like preview thumbnails.
    So, if you upload a video named butterfly.wmv to http://yourSite/sites/demo/Assets the path to the video would be http://yourSite/sites/demo/Assets/butterfly/butterfly.wmv. If the user changed the name while uploading the file to "Pretty bugs"
    the URL would then be http://yourSite/sites/demo/Assets/Pretty%20Bugs/butterfly.wmv.
    Probably the best way to explore these hidden folders and discover the "real" URL is to use SharePoint Designer 2013.
    Launch SharePoint Designer and open your site.
    In the Navigation area click "All Files". (If you don't see All Files then your administrators may have partially locked down SPD.)
    In the list of files and folders click the Assets library.
    Find and click your video (you will see the "Name" as entered in the file's properties, not the file name.)
    Find the video file, right-click it and click Properties.
    Copy the Location.
    If you just want to display the video in the page:
    Edit the page
    Click INSERT
    Click Web Part
    From the Media and Content category select Media Web Part and click Add.
    Edit the web part (click the web part's dropdown)
    From the MEDIA ribbon click Change Media
    Click From SharePoint and navigate to your assets library and pick a video
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • How can I create a full width composition

    Hi All
    I'm loving the new update and as usual this leads onto other things.
    How can I create a full width (scalable) composition without a work around?
    The new full width icon only seems to work with slideshows.
    Thanks
    Paul

    Did anyone ever figure this out or get an answer?  I like how it works on this site:
    LIVESTRONG.org
    Click on the words and links in the pictures but it is  full width.  The full width option isn't available on a composition.

  • Can you specify the full path to jar in archive_jini

    can you put the full path to the client.jar file in the formsweb.cfg archive_jini parameter? like this:
    archive_jini=d:\something\somethingelse\client.jar
    or does it have to exist under %ORACLE_HOME%\forms\java ?

    None of the two. The path path is a relative web-url, for the content of archive_jni will be placed in the generated html which is "executed" by the users browser. So you either place your jar in $ORACLE_HOME/forms/java and put it without any path in the archive_jni-tag, or (more appreciated by myself), create a virtual directory (either by alias or by orion-web.xml) in your oas and place the jar in the according phycial path.

  • How can I get my full wallpaper on the iOS 7 Homescreen?

    Well, I have a Wallpaper 1000x3000 pixels. How can I get the full wallpaper on the screen without it is zoomed? So that it has up and down a black line?

    You can try this:
    http://support.apple.com/kb/HT5595
    If that doesn't fix things, you may want to try my workaround:
    https://discussions.apple.com/thread/5335229?tstart=90

  • When I try and print an "Approach Plate, or Departure" from ForeFlight to my Epson Stylus NX430 using AirPrint the image is resized. How can I print without it resizing. I want to have the plate print in the original size so I can use it.

    When I try and print an "Approach Plate, or Departure" from ForeFlight to my Epson Stylus NX430 using AirPrint the image is resized. How can I print without it resizing. I want to have the plate print in the original size so I can use it. Is this an Apple, Epson, or Foreflight Issue? I just purchased the printer so I can return it and get a different model or brand. I spoke to Epson and the suggestions given did not resolve the issue. I have cut the paper down to the size of the plate roughly 5.5x8 and it still try's to print at 8.5x11. I have also requested help through ForeFlights Tech help but have yet to receive an answer.
    Please help!

    It varies based on what you ordered and whether it is in stock or has to be assenbled and shipped from China. Your email conformation should give an estimate of when the items are expected to be shipped or available for pick up if you are having it sent to a local Apple Store.

  • How can I create a full-screen view of Keynote slide in Snow Leopard?

    How can I create a full-screen view of my Keynote slides in Snow Leopard?
    I'm going to be importing into ScreenFlow to create a video.
    Thank you!!

    Welcome to Apple Support Communities.
    Do you want static screen captures or motion video of slides as titles, bullet points, and the like are presented?
    Run the Keynote slide presentation in full-screen mode, then...
    Static full-screen captures - use Command+Shift+3.
    Static partial-screen captures - use Command+Shift+4 and use cursor to select the area of the screen to capture.
    If you want motion video as builds occur, why not use Keynote's built-in Share, Export function?
    (I'm on iLife '09.)
    Also understand that the default slide format for Keynote is 1024x768, not full-screen MacBook 1280x800 screen size, so you'll have wide black borders unless you change the default size or crop the finished screen captures.
    Message was edited by: kostby

Maybe you are looking for

  • Reschedule strategy plan based on last actual order completion date

    Dear all, Hope you can help me with this one. We use strategybased maintenance plans. We want to achieve that the next scheduled call date is calculated taking into account the actual completion date of the last (previous) call. For example : strateg

  • How do I create a new library in LR5 with photos from LR3 and older computer?

    I want to take photos I originally imported with LR3 on an older computer and creat a new library in LR5 on my new computer. I want to throw out all old metadata, folder names and keywords and start from scratch. How would I go about this. My photo l

  • How Good are the Graphics?

    Hello, I am looking to buy a new computer and I'm looking for one that will be able to run modern games such as Grand Theft Auto V (GTA V), H1Z1, Battlefield Hardline, maybe Garry's Mod (Gmod), and any other games to be released in the future that se

  • How to get full image from adress book contact

    I'm trying to get the full image out of an address book contact. All my basic code is working. The problem that I am having is that for all contacts with images the returned image size is 320x320. Playing around I have edited contacts, through Contac

  • How do i recover a purchased app

    Since I can't merge my appleID's, This makes no sense, but.... I have a purchased app that is showing up for ugrade, but everytime I clickit to upgrade I get a popup stating that I should login to the account I purchaced it from.... I login to my oth