|
Answer» HI EVERYONE hope everyone is OK.
I am wondering if it is possible,
I want to be able to run a script that deletes all files within a profile folders
basically i have somthing like this setup
folder locations
\\servername\students$\2001\username\profile
ok so replacing the username with the name of that USER.
i want to be able to have a script frun through all these folders and delete everything in the profile folder.
So i was trying somthing like this
ECHO cd \\servername\students$\2001\%FOLDERNAME%\profile del *.*
though the %foldername% is an INVALID swtich.
Anyone know if this is possible and if so how.
any help is much appreciated.
Thanks for your time.
Chris SmallThis should werk in dos mode!: Code: [Select]del "\\servername\students$\2001\%FOLDERNAME%\profile\*.*" If you are wanting to make a batch file to do it, this would be the code: Code: [Select]@echo off del "\\servername\students$\2001\%FOLDERNAME%\profile\*.*" exitWhat are you actually wanting to do this for??With a loop around it, the following should do what you want: Code: [Select]set list=%temp%.\students.txt dir /ad/b "\\servername\students$\2001\">"%list%" for /f "usebackq tokens=*" %%a in ("%list%") do del "\\servername\students$\2001\%%a\profile\*.*"The first line defines a file student.txt that will temporary store all student names. The second line dumps all students into student.txt, assuming that the 2001 folder only contains student folders. The third line loops through all students listed in student.txt and cleans the profile folder.
Hope this helps
|