' Author: Twily aka Analie 2018
' Description: Make Windows OneDrive folder and subfolders accessible from Linux system.
' Run this script before powering off Windows, then boot Linux!
' (Untested: can also be scheduled to run on Windows login).
' NB: Depending on how many files, it may take a bit to complete (Personal
' estimation on own computer; 30 seconds for 2000 entries).
'On Error Resume Next
Dim PATH, TEMP, STR, BATCH, EXEC, ACTION
PATH = "C:\Users\awv\OneDrive"
TEMP = "C:\TEMP\ONEDRIVESUB.TXT"
EXEC = "C:\TEMP\ONEDRIVESUB.BAT"
BATCH = "@ECHO OFF" & vbNewLine & "CLS" & vbNewLine & "fsutil reparsepoint delete """ & PATH & """" & vbNewLine
Set WshShell = WScript.CreateObject("WScript.Shell")
'Return = WshShell.Run("CMD /C DIR """ & PATH & """ /S /AD /B > """ & TEMP & """",0,True)
Return = WshShell.Run("CMD /C DIR """ & PATH & """ /S /B > """ & TEMP & """",0,True)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FILE = FSO.OpenTextFile(TEMP)
Do Until FILE.AtEndOfStream
STR = FILE.ReadLine
If VarType(STR) = 8 Then
If STR <> "" Then
BATCH = BATCH & "fsutil reparsepoint delete """ & STR & """" & vbNewLine
End If
End If
Loop
FILE.Close
If FSO.FileExists(TEMP) Then
FSO.DeleteFile TEMP
End If
Set FILE = FSO.CreateTextFile(EXEC,True)
FILE.Write BATCH
FILE.Close
Return = WshShell.Run("CMD /C """ & EXEC & """",0,True)
If FSO.FileExists(EXEC) Then
FSO.DeleteFile EXEC
End If
'WScript.Echo "Done (OneDrive reparse point):" & vbNewLine & vbNewLine & """" & PATH & """ and all its content have had their reparsepoint deleted, you can now access from linux!"
ACTION = MsgBox("OneDrive reparse point deletion is completed." & vbNewLine & vbNewLine & "Do you wish to reboot your computer now?", vbQuestion + vbYesNo , "OneDrive Reparse Points Deleted")
Select Case ACTION
Case vbYes
Return = WshShell.Run("CMD /C SHUTDOWN /R /T 0",0,True)
Case vbNo
End Select
WScript.Quit
Top