![]() ![]() I believe my issue is in the way I am referencing the variable later in the Thank You for the tip, however once I added the suggested piece to the beginning of my script I now when I run the script I receive the error "Expected Literal Constant". ![]() ExpandEnvironmentStrings ( "%USERPROFILE%" ) Set oShell = CreateObject ( "WScript.Shell" ) Any assistance or tips would be greatly appreciated. However when I do the script is stall unable to recognize the %userprofile% variable. If ( = 0) Then objSubFolder.Delete True End If Nextīased on a little research I believe I should add this piece to the script (see below). Sub Search(str) Dim objFolder, objSubFolder, objFile Set objFolder = objFSO.GetFolder(str) For Each objFile In objFolder.Files If objFile.DateLastModified < (Now() - 90) Then objFile.Delete(True) End If Next For Each objSubFolder In objFolder.SubFolders Search(objSubFolder.Path) ' Files have been deleted, now see if ' the folder is empty. Set objFSO = CreateObject("Scripting.FileSystemObject") ![]() Here is the current script that I am using without trying toĬonst strPath = "c:\KCraig\OneDrive for Business" I have done some research no delacing Windows Variables however I'm not a scripting expect and am a little confused. When I try to use the %Useprofile% to make the path relative the script fails. I am able to get the script to work correctly if I use the absolute path ("C:\\OneDrive for Business") however I am currently working on a VBscript that will delete any files with a "Modify date" of older than 90 days. ![]()
0 Comments
Leave a Reply. |