problem of FILE
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: problem of FILE

  1. #1
    Join Date
    Apr 2003
    Location
    paris
    Posts
    67

    problem of FILE

    hi all,

    i want to know if a file exists, here is my code :

    ------------------------
    File dd = new File("G:/SQL.LOG");
    boolean f = dd.isFile();
    out.println("dan = " + f);
    ------------------------------
    (the file sql.log exists)
    i can see :" dan = true"

    that's logic

    but when i change the code:

    ------------------------------
    File dd = new File("G:/act_tma/test.log");
    out.println(rep_tableau + nom_tableau);
    boolean f = dd.isFile();
    out.println("dan = " + f);
    -----------------------------
    (the file test.log exists)
    i can see: "dan = false"

    what is not logic...

    have you an idea???

    PS : G:/ is connected to a network
    L'alcool tue lentement. On s'en fout. On n'est pas pressÚs.

  2. #2
    Join Date
    Apr 2003
    Location
    paris
    Posts
    67
    it's the same thing if i put the method exists() instead of isFile()

    why???
    L'alcool tue lentement. On s'en fout. On n'est pas pressÚs.

  3. #3
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    f.exists() verify if the file indicated by this path exists and
    f.isFile() verify if the file exists and is a norma file (is not a directory and satisfy other conditions which dependts of your system)
    See Java API documentation

  4. #4
    Join Date
    Apr 2003
    Location
    paris
    Posts
    67
    the path exists but when i use the method exists(), it returns always false...
    L'alcool tue lentement. On s'en fout. On n'est pas pressÚs.

  5. #5
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    normal I mean (I ate an "l")
    I don't really know what exactly means "normal file" but I think that a "system file" is not a regular file for example. I hope I don't mistake !

    Cristian

  6. #6
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    I think beacause this file with ".log" extension isn't a regular file ...

  7. #7
    Join Date
    Apr 2003
    Location
    paris
    Posts
    67
    when i use a .xls, it's the same thing...
    L'alcool tue lentement. On s'en fout. On n'est pas pressÚs.

  8. #8
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    Sorry I was wrong, but I think this is a network problem ...

  9. #9
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    try for the same files but local, on your machine

  10. #10
    Join Date
    Apr 2003
    Location
    paris
    Posts
    67
    it works on local
    but it works also on the root of G: which is on the network...
    L'alcool tue lentement. On s'en fout. On n'est pas pressÚs.

  11. #11
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    Maybe you don't have sufficient rights to those files on the network

  12. #12
    Join Date
    Apr 2003
    Location
    paris
    Posts
    67
    but i can open those files "manually"
    L'alcool tue lentement. On s'en fout. On n'est pas pressÚs.

  13. #13
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    Yes, but in order to access them from an Java programme I think you should have full acces to the path where "they" are.

  14. #14
    Join Date
    Apr 2003
    Location
    paris
    Posts
    67
    do you know a method to copy it on the local machine?
    perhaps with 'cp' of MSDOS console?
    L'alcool tue lentement. On s'en fout. On n'est pas pressÚs.

  15. #15
    Join Date
    Apr 2003
    Location
    Romania
    Posts
    19
    copy source destination (for MS-DOS)
    Ctrl+C and Ctrl+V in your destination path .... (other OS)

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center