Re: [Emerald] OT: File moving problem

DAN TANG ( (no email) )
Tue, 15 Jun 1999 10:52:17 +0800

Piece of cake if you are running SQL 7.0, this is the script you need to run
under Query Analyzer.

DECLARE @ShareName varchar(200)

SELECT @ShareName='\\Server\ftp\home\' /* The shared FTP directory */

DECLARE curChDir INSENSITIVE CURSOR
FOR Select Login,HomeDir
FROM Subaccounts
WHERE Datalength(HomeDir)>0
FOR READ ONLY
DECLARE @Login varchar(60)
DECLARE @HomeDir varchar(200)
DECLARE @cmdStr varchar(500)

OPEN curChDir
FETCH NEXT FROM curChDir INTO @Login,@HomeDir
WHILE @@FETCH_STATUS=0
BEGIN
SELECT @cmdStr= 'IF Exist ' + @ShareName + @Login + '\Public_Html ' +
' XCOPY ' + @ShareName + @Login + '\Public_Html ' + @ShareName + @Login +
' /s /e /c /h /a /k'
EXEC Master..xp_cmdshell @cmdStr
SELECT @cmdStr='IF Exist ' + @ShareName + @Login + '\Public_Html ' +
'rd ' + @ShareName + @Login + '\Public_Html /s /q'
EXEC Master..xp_cmdshell @cmdStr

FETCH NEXT FROM curChDir INTO @Login,@HomeDir
END
CLOSE curChDir
DEALLOCATE curChDir

Regards,

Dan Tang
Network Operation
Domain Internet Access
---------------------------------------------------
Sign Up a Dial up account at http://isp.dmn.com.au and get connect right
now.
---------------------------------------------------
Join the Emerald ASP Addon Product mailing list
by sending email to emerald-request@dmn.com.au with message body SUBSCRIBE
only

-----Original Message-----
From: David V. Brenner <dvb@cport.com>
To: emerald@iea-software.com <emerald@iea-software.com>
Date: Tuesday, June 15, 1999 9:54 AM
Subject: [Emerald] OT: File moving problem

>Hi, folks. I have a need to move a bunch of files in the following manner:
>
>From: d:\ftp\home\<username>\public_html\*.*
>To: d:\ftp\home\<username>\*.*
>
>...where <username> is approximately 400 directories used for my customers'
>home pages. The idea is to eliminate the public_html directories so as to
>have our non-FrontPage customers' directories be more consistent with those
>of the FrontPage customers. We also want to make sure that everything is
>consistent with the way we have Emerald and Serv-U set up
>
>I have been contemplating the best way of accomplishing this, but nothing
>I've tried seems to work and the one-by-one method does not appeal to me in
>the least, either.
>
>I am not averse to using a utility, although I also have the latest Perl,
>4NT and the Windows NT 4.0 resource kit at my disposal.
>
>Anyone have any ideas? It seems like a job for scripting language, but I
>would think 4NT could do it as well... that is, if I could figure out the
>syntax.
>
>___________________________________
>David V. Brenner - dvb@cport.com
>International Services Network Corporation
>http://www.cport.com
>
>