-
December 3rd, 2008, 03:52 AM
#1
Moving files
Hi, since I got my previous problem sorted out real easy by posting on this forum, I decided to post another problem I have. In my code I want to move a file from a path in a text box to another path in a different textbox. For example, say I have C:\Pictures\Flowers.jpg in the first textbox and C:\Programs\ in the other textbox and I click a button, the flowers.jpg in the pictures folder should be moved to the programs folder. Simple enough right? Well how can I do this without it renaming Flowers.jpg to something in the second textbox? Sorry my problem may be confusing.
-
December 3rd, 2008, 04:39 AM
#2
Re: Moving files
Copy the original file from start location (textbox1 path) to end location (textbox2 path) and then delete the original file. before copy always check if the file exists on the start location otherwise an exception will be thrown.
clear enough or not ?
-
December 3rd, 2008, 05:21 AM
#3
Re: Moving files
or check the directory names in the textboxes, if they are the same don't do anything otherwise move the file. you may use System.IO.Path to manipulate path names, and then use System.IO.File to move files.
Busy
-
December 3rd, 2008, 06:17 AM
#4
-
December 3rd, 2008, 06:17 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|