[Help]Copy and replacing files

Posts 1–15 of 21 · Page 1 of 2
[Help]Copy and replacing files
Hey guys. I need to ask this..

is there a plan for preventing pop-up while replacing it to a new location?

Well, Here is an example.
I want to swap 2 files in their locations but their names will be the other file which was swapped too
Ex:
File1[Folder1] --->>> File2[Folder2]
File2[Folder2]--->>> File1[Folder1]

I use this codes as swapping them but there is a pop-up. but I just want to copy and replace it without the pop-up
Code:
My.Computer.FileSystem.MoveFile("C:\Folder1\File1.txt", _
    "C:\Folder2\File2.txt")

My.Computer.FileSystem.MoveFile("C:\Folder2\File2.txt", _
    "C:\Folder1\file1.txt")
Oh. btw. My reason why i'm asking this because
I'm making a program which changes the file location using the timer...
I like to play a game with my friends that Every second, the notepads changed locations and changes names... then we will need to look for the message of our friends by searching it on 9 folders.
[1 folder = 9 notepads]

Its kinda interesting if you like to do it with your friends ^^
well, you need admin privileges put on to your program to be able to do that, since the folder is in the root drive...
Quote Originally Posted by mnpeepno2 View Post
well, you need admin privileges put on to your program to be able to do that, since the folder is in the root drive...
I'm the only one who controls my computer ^^
I do think there is a way of preventing this. Idk how to tho :/
Run as Admin?

And a screenshot of the "popup" would be nice.
Here is a screenshot...
Meh, It's possible and not complex, however , Windows settings trump vb settings, Best bet, Rename File or Delete File before moving it.

So the one to be replaced, rename it dsetup.bak
Quote Originally Posted by NextGen1 View Post
Meh, It's possible and not complex, however , Windows settings trump vb settings, Best bet, Rename File or Delete File before moving it.

So the one to be replaced, rename it dsetup.bak
Oh. Okay. I'll try that.

but is there any way to delay those other codes so they might not replaced.

Let's say... when a messagebox has popped out, then the first move will go.

then the other 2 will respond after in a short time
cant you just mask the name?
Quote Originally Posted by zmansquared View Post
cant you just mask the name?
Sorry. But i'm still a beginner in visual basic.
I don't know what you mean.
use my sleep code in the snippets vault, that will delay the actions
Quote Originally Posted by NextGen1 View Post
use my sleep code in the snippets vault, that will delay the actions
Could you kindly give me a sample code for moving a file by .50 seconds? [that will be the last question at the topic ^^ ]

btw. I'll read your snippets. it is helpful to me.
Top Of my head

It should be

Code:
 Dim filetr As New FileInfo("Dsetup.dll")
   
   filetr .MoveTo("Dsetup.bak")

Sleep (500) ' Remember in order for this to work you need to add the sleep code from the snippets form, otherwise you can use threading.sleep, but I don't recommend it.
 
 Dim filetm As New FileInfo("C:\Location\Dsetup.dll") ' Your location = wherever file is located
   
   filetm .MoveTo("Wherever you want it\Dsetup.dll")  ' Wherever it is this file needs to go
O i didnt think of that. man, gen ROCKS
It works now. Thanks sir Gen

[I'll not create a thread anymore since this might be simple to you guys]
what code should it be if you want to copy the content of a textbox by using a button?
Posts 1–15 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us