Page 1 of 1 1
Topic Options
#156500 - 2006-02-02 01:20 PM Move files based on username
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
I have a text box where a username is inserted. There is a button next to the box. What I want to happen is as follows: When the button is pressed, the computer connects to a network share on the network (\\server\data\), finds the folder that is has the same name as the username in the text box, and then transfers the users files from the network to the local drive (c:\data). Any help would be appreciated.
Top
#156501 - 2006-02-02 01:52 PM Re: Move files based on username
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
This should give you an idea

Code:
  
break on

$Textbox.OnClick = 'TextBoxOnClick()'
.
.
.
function TextBoxOnClick()
dim $serverPath,$localPath
$serverPath = '\\Server\Share\' + $Textbox.text
$localPath = 'c:\data'
if exist($serverPath)
copy $serverPath + '\*.*' $localPath /c /h /r /s
endif
endfunction


Top
#156502 - 2006-02-02 02:54 PM Re: Move files based on username
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Move or copy?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#156503 - 2006-02-02 03:06 PM Re: Move files based on username
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
An excellent point. Copy please.
Top
#156504 - 2006-02-02 04:03 PM Re: Move files based on username
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
Thank you maciep. Your code works a treat.
Top
#156505 - 2006-02-02 04:07 PM Re: Move files based on username
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Thanks...but i just realized that the top portion should be the button not the TextBox...didn't have enough coffee when i wrote that
Top
#156506 - 2006-02-03 05:07 PM Re: Move files based on username
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
The below script that maciep gave me works a treat. Is there any way to add a progress bar to it?

Code:
 Function CopyUser()

dim $serverPath,$localPath
$serverPath = 'C:\data\Share\' + $User.text
$localPath = 'c:\data\User\'
If exist($serverPath)
Copy $serverPath + '\*.*' $localPath /c /h /r /s
EndIf

EndFunction


Top
#156507 - 2006-02-03 06:55 PM Re: Move files based on username
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You could try the GUICopy() UDF.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#156508 - 2006-02-04 10:02 AM Re: Move files based on username
kirkside Offline
Getting the hang of it

Registered: 2006-01-19
Posts: 52
Loc: UK
Sorry to show my inexperience with this, but where would I put the GUICopy code in my script. The CopyUser() Function is activated when clicking on a button.
Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1219 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.21 seconds in which 0.111 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org