本帖最后由 杨兴庭 于 2013-7-30 22:39 编辑
- public static void main(String[] args) {
- File file = new File("/192.168.51.160/test/copy/a/base.avi");
- if (file.exists()) {
- File temp = new File("/192.168.51.160/test/copy/a/base.avi_temp");
- if (file.renameTo(temp)) {
- System.out.println("重命名成功!");
- }
- if (temp.exists()) {
- System.out.println(temp.getName()+"存在!");
- try {
- RandomAccessFile Rand = new RandomAccessFile(file, "rw");
- Rand.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
复制代码 |
|