Question How to move file inside the empty directory

Rainny

Member
Joined
Jun 9, 2008
Messages
16
Programming Experience
Beginner
Hi, everyone.
I have some question and need helping from you all.

May I know that how to move a file into an empty directory?
What I want is when I place a new file inside a folder, the old file then will automatically move into another folder and rename as another file name? This is because so far I just can find replace one file with another file only, so I am still stuck here. Hope that can help me to solve this problem.

Thank you.
 
Hello.

Take a look ath the System.IO.File Class. It has functions to move/copy files around.

Bobby

Hi, if I use system.file.IO.move, it does not work for me. This is because I want to move one file into another empty directory, and not replace one file with another file. However, the System.IO.file.move function needs to specify the source file and the destination file. Thus, any best suggestion to move one file from one folder into another empty folder? Besides, after I move the file into the empty folder, how do I rename the file by using today date?
May I know also how to compare the two files if they are silmilar,if find there are the same file and then I can move the file inside the empty folder?
 
Good morning.

What do you mean with empty directory? One which needs to be created or one which is just empty?

Also, renaming is within moving included:
VB.NET:
'create the directory...if that's no even included in the Move-Function...
System.IO.Directory.Create("D:\NewFolder")
System.IO.File.Move("C:\Temp\originFile.txt", "D:\NewFolder\" & Date.Now.ToString("yyyyMMdd_hhmmss") & ".txt")

Bobby
 
The empty directory I means here is the directory which is already created. For example, there are two directory, one is copy folder and another is paste folder. I want copy the file from copy folder to the paste folder.When I copy the file, I also want to ensure that there are not same file in the paste folder.
If found there are already exists the file, then I want to move it to another folder and also by renaming the file. So, I want to compare the file in copy folder and paste folder, after comparing it, then I copy the file from copy folder to paste folder. Is there any function for me to do that?
Can anyone help me, thanks a lot.
Regards
 
Back
Top