Computing.Net > Forums > Programming > Moving Files using Java

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Moving Files using Java

Reply to Message Icon

Name: sju59
Date: September 24, 2002 at 23:18:32 Pacific
OS: Winxp/Mandrake 8.2
CPU/Ram: 866/384Mb
Comment:

Basics:
I want to know how to write a program that can move files from one directory to another automatically, without changing the files at all.

More in Depth:
I know how to program quite a bit in Java so that's why I mentioned that language, but I would be open to suggestions. I want to write a program that looks in a folder of mine, looks at the names of the files and then moves the file to a different directory. I just don't have any idea how java moves files. Any help?? Thanks a ton.



Sponsored Link
Ads by Google

Response Number 1
Name: Mike Ryan
Date: September 25, 2002 at 18:03:00 Pacific
Reply:

Try using renameTo method of File class.

For example: you could write something like...

File f = new File("existing.file");
f.renameTo(new File("c:\\temp\\new.file.name");



0

Response Number 2
Name: sju59
Date: September 25, 2002 at 21:12:18 Pacific
Reply:

That's a cool way of doing it, I think that would work. I really haven't done a whole lot of work actually manipulating files with java, so I'm kinda clueless how to do this. Are there other languages that allow you to move files around easily and still allow a graphical frontend?

Thanks.


0

Response Number 3
Name: mitra
Date: September 27, 2002 at 08:41:49 Pacific
Reply:

just look at java documantations
if you don't have it download it from www.java.sun.com
you can find enough help on every field in it.
so can can see help for each java class with all of its methods there.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Moving Files using Java

Batch to move file by sysdate www.computing.net/answers/programming/batch-to-move-file-by-sysdate/14939.html

How do I move files using a .bat? www.computing.net/answers/programming/how-do-i-move-files-using-a-bat/15473.html

Using Java Script to write to a tex www.computing.net/answers/programming/using-java-script-to-write-to-a-tex/3283.html