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
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.
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.
Summary: If you use the 'current' system date, you will always have to run the program 'today' or the file date would never match. A better solution would be to input the desired date. I use a compiled BASI...
Summary: move u:\mystuff\*.doc "C:\Program Files\Microsoft Office\Office10\1033\" ===================================== If at first you don't succeed, you're about average. M2 ...
Summary: Does anyone know how, or if there is a way to use Java Script, or another programing tool to write to a text file, or html file, or ini, i dont really care which just as long as i can read from it, lo...