473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to move files?

hi,
I want java code to move multiple files from one folder of one server to another folder of another server.
source folder is in windows & target folder is in linux server.
if anyone knows.please help me.
Oct 14 '11 #1
1 2682
Frinavale
9,735 Expert Mod 8TB
Of course there are experts here who know how to move files :)

Your question is too vague and large to answer. You need to attempt to solve this problem before asking the experts here for help with the topic. That way we can help you more easily.

To move a files from somewhere to somewhere else you need to:
  1. open the directory that contains the files that are to be moved
  2. loop through the contents of the directory and for each file that you want to move do the following:
    1. copy the file that you want to move into memory
    2. create a new file (using the same name as the file you have copied into memory) in the new directory
    3. write the file's contents into the new file
    4. delete the original file (in the old directory)
    5. close all file handlers/connections
  3. close any directory handlers/connections that you were using

So what you need to do is research what classes are required in order to open a directory and work with files.

-Frinny
Oct 14 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jianren Lu | last post by:
Dear all, Could you please tell me how to move files into trashbox? FileInfo.Delete() will delete files completely. But I want to get files back if necessary. I searched document of .net framework...
10
by: dermot | last post by:
I have wrriten a small windows service application in visual studio ..net 2003 which listens for incoming FTP files. These files would overwrite over time due to duplicate file names. However any...
2
by: Evan Carmi | last post by:
hey, i am trying to move files with a specific file-ending (.msf) to dir above their current location. my code so far works as long as all the files are on the same dir level. but how can i...
2
by: Kevin D. Smith | last post by:
I would like to move files and directories to the Recycle Bin on Windows from Python. I have found some older articles describing how to do this, but they require additional packages to be...
3
by: =?Utf-8?B?UHVyZSBIZWFydA==?= | last post by:
hi i need the code to move files from directory to another directory on sam local machine or to a network path, thank you. -- Ammar S. Mitoori IT Head QIMCO Co. Tel : +9744831199 Mobile :...
3
by: jaeden99 | last post by:
I was wandering if nyone has a script to move files older than x days old? i've seen several to delete, but I don't want to delete. I would like to create a backup of the files first verify with...
2
by: Jim in Arizona | last post by:
I made up a service that will move files from a folder on the machine that the service is running to a share on another machine. I use a try/catch incase an error is thrown and write that error to...
8
by: inFocus | last post by:
Hello, I am new to python and wanted to write something for myself where after inputing two words it would search entire drive and when finding both names in files name would either copy or move...
1
by: ajames270 | last post by:
I would like to cretae a program to move files from one directory to another... ex: from c:\in to c:\out so anything in c:\in would be moved. I would like this to run every 30 or 40 seconds.
2
by: xavix | last post by:
Hello, How can I move files based on age in the following scenario: $SOURCE contains some subfolders with some files inside them. Each subfolder contain files of the same date, but the last...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.