Page 1 of 1 1
Topic Options
#9478 - 2001-06-14 12:56 AM Copy a file to all user areas
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Is there a command or script out there that will enable the administrator with a admin rights to copy a file to every single directory under ashare. For example I want to copy J:\testl.doc to \\masternt\users-- then each and every directory under the users share? Ideas anyone? thanx in adavance.

------------------

_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#9479 - 2001-06-13 01:15 PM Re: Copy a file to all user areas
Ghost Offline
Starting to like KiXtart

Registered: 2000-09-14
Posts: 171
Hi

I wanted to do this with some files onto the hard drive of every computer (it was a screen saver advertising the upcoming Oliver production at the school). I was able to copy the file and configure the screen saver.

I have used a script that copied the files at login.

This could be adapted to copy the file to the users home directory without too much problem.

Use the @USERID in the command like this:

copy source \\masternt\@USERID\filename

This should work fine.

_________________________
Who are you? Who slips into my robot body and whispers to my ghost?

Top
#9480 - 2001-06-13 11:17 PM Re: Copy a file to all user areas
Anonymous
Unregistered


code:

BREAK ON
;Assuming NT use %comspec% if mixed 9x/NT

$server = "\\mightymouse"
$share = "C$"
$file = file.ext

shell "cmd /c dir $server\$share /ad/b > dirlist.txt"

OPEN (1, "dirlist.txt")
$dir = readline (1)

WHILE @ERROR = 0
copy "$file" "$server\$share\$dir\"
$dir = readline (1)
LOOP

:cleanup

del dirlist.txt


This dumps a bare list of directories to a file. The file is then opened by kix and each line is read in. A file is copied to each direcitory. It does this until it cannot read any more lines from the dirlist.txt file (until @error is not 0).

[This message has been edited by JasonC (edited 14 June 2001).]

Top
#9481 - 2001-06-13 11:55 PM Re: Copy a file to all user areas
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Why not do it during logon, after you attach the user directory? If you want to recursively put the file into sub-directories owned by the user there are several examples posted on the board for recursively traversing a tree of directories.

If you have not created real shares for each user (instead of the pseudo shares created by the User manager) you may have difficulty doing this on the server. Getting into the default user directories is difficult. They are created as owned by the user with no one else permitted any type of file access. No share permissions are set at all. In order to get access you must take ownership of the user directory which breaks the users access. Catch-22.

_________________________
Jack

Top
#9482 - 2001-06-15 11:04 AM Re: Copy a file to all user areas
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Hi,

The users directories are hidden shares that is:-

\\srvnme\users\usrname$ so each user is shared out. All I want to do is copy a file from a directory into each user directory.

------------------

_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#9483 - 2001-06-15 05:13 PM Re: Copy a file to all user areas
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
You really have 2 choices. Follow Jason's advice & do it on the server. I wouldn't bother using kix for this. I would possibly use scopy & the for command in a batch script but kix could do the job.

The other possibility is a variant of what ghost recommends - doing it at logon. I believe that several scripts have been posted recently for spanning a directory tree. Adapt one to suit your needs.

_________________________
Jack

Top
Page 1 of 1 1


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

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.058 seconds in which 0.029 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