Scripts Thread, REQUEST: Script 2 copy from multiple source folders 2 one folder BUT keep permissions in Coding and Web Development; As srochford has kindly sorted my other script, I can now move all of the students MP3 out of their ...
Why you need to copy multiple directories? I've not looked at your other script but i imagine it would recursively go throught all folders and rename all the mp3. Could you not just move it after its been renamed or even copy it to the desired location but with the desired name. This way you wouldnt need to copy the permissions.
Students will hide there MP3 collection in eg. N:/school work/ict/homework/dont go in here/music.....
I want to be able to move them from all these various directories to one central location. For the other script that renames it needs to read the owner of the file.
If I copy it would replace me as the owner. If i was to rename first, then when they are moved it would then ammend myself as the owner when the script next runs.
Think I'm being abit slow today.. put it down to the Mondays.
From what you said, theres an issue with renaming it first then moving it because when its moved you are the owner and therefore when the script runs again your name will be used.. why does the rename script need to be run twice?
The way i say it this is what should happen:
For all files in directory
if .mp3 then
copy file to desired location (process of coping will rename file e.g. copy file.mp3 O:\directory\newfile.mp3)
Thats what i think it should do.. atleast in pseudo.
maybe i could look at your other script and i could adapt that one.
The rename Script will be run regularly in that share, as in the future the only place that they will be able to save MP3 files to will be the new share.
So they copy a file into there and it then gets renamed. This script will only be run once to MOVE all their current MP3 files.
great stuff !! thankyou for trying this for me, I dont know where id be without all you edugeek scripting experts!
Unfortunetly im getting:
Error: Expected end of statement
Source: MS VBScript Compilation Error
hope this means more to you than it does to me!!!
Heres the exact code I used:
strSourceFolder = "\\nas\Student_Drives\05\teststudent\My Music" 'eg d:\users\students
strDestFolder = "\\nas\Student_media\Music Files" 'eg d:\share
strLocationXcopy = "c:\xcopy.exe" 'eg c:\xcopy.exe
set objFSO = createobject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
sub GetFiles(byval strDirectory)
set objFolder = objFSO.GetFolder(strDirectory)
for each objFile in objFolder.Files
If right(objFile.path,3) = "mp3" Then
wshShell.run strLocationXcopy & " '" & objFile.path "' " & "'" & strDestFolder & "' /o"
for each objFolder in objFolder.SubFolders
Last edited by ChrisH; 14th June 2010 at 06:35 PM.