About This File
Attributes Tool
Features :
- USB Hidden Folder Fix: Show hidden files in USB and delete (.ink) files.
- Rename Unicode (Vietnamese to ASCII - Loại bỏ dấu Tiếng Việt ở tên tập tin và thư mục).
- Set timestamp for the files/folders.
- Quickly delete files/folders.
- |R|: cleanup junk file on computer.
- |H|: Hide HIDDEN files in Windows.
- |S|: Show HIDDEN files in Windows.
Use :
- Select mode
- Drag and drop files/folder into program window Or press buttons and select files/folders.
Or Run: AttributesTool.exe "AnyFilesPath.ext" "AnyFilesPath.ext" "AnyFilesPath.ext" (Using the previous configuration was selected!)
Run as Administrator and select Try Force to the best use!
Function:
#RequireAdmin Func _SetAttributes($sFileDirIN, $sAttribSet, $sRecurseDir = 1, $sForce = 1) If Not FileExists($sFileDirIN) Then Return SetError(1, 0, 0) $sAttribSet = StringStripWS($sAttribSet, 8) If $sAttribSet = "" Then Return SetError(2, 0, 0) If $sRecurseDir = 1 Then If StringInStr(FileGetAttrib($sFileDirIN), 'D') <> 1 Then $sRecurseDir = 0 EndIf Local $SetAttrib = FileSetAttrib($sFileDirIN, $sAttribSet, $sRecurseDir) If (@error Or $SetAttrib = 0) And $sForce = 1 Then _TakeOwnership($sFileDirIN) $SetAttrib = FileSetAttrib($sFileDirIN, $sAttribSet, $sRecurseDir) EndIf Return SetError($SetAttrib = 0, 0, $SetAttrib > 0) EndFunc ;==>_SetAttributes Func _TakeOwnership($xFile) If Not FileExists($xFile) Then Return SetError(1, 0, $xFile) If StringInStr(FileGetAttrib($xFile), 'D') <> 0 Then RunWait(@ComSpec & ' /c takeown /f "' & $xFile & '" /R /D Y', '', @SW_HIDE) RunWait(@ComSpec & ' /c Echo y|cacls "' & $xFile & '" /T /C /G Administrators:F', '', @SW_HIDE) RunWait(@ComSpec & ' /c icacls "' & $xFile & '" /grant Administrators:F /T /C /Q', '', @SW_HIDE) Return SetError(0, 0, 0) Else RunWait(@ComSpec & ' /c takeown /f "' & $xFile & '"', '', @SW_HIDE) RunWait(@ComSpec & ' /c Echo y|cacls "' & $xFile & '" /C /G Administrators:F', '', @SW_HIDE) RunWait(@ComSpec & ' /c icacls "' & $xFile & '" /grant Administrators:F /Q', '', @SW_HIDE) Return SetError(0, 0, 1) EndIf Return $xFile EndFunc ;==>_TakeOwnership Func _IsUSB($sDrive) Local $sIsUSB = 0, $sType = DriveGetType($sDrive, 3) If DriveGetType($sDrive, 1) = "Removable" Or $sType = "USB" Or $sType = "SD" Or $sType = "MMC" Then $sIsUSB = 1 Return $sIsUSB EndFunc ;==>_IsUSB Func _SplitPath($sFilePath, $sType = 0) Local $sDrive, $sDir, $sFileName, $sExtension, $sReturn Local $aArray = StringRegExp($sFilePath, "^\h*((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*[\/\\]\h*)?((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1) If @error Then ReDim $aArray[5] $aArray[0] = $sFilePath EndIf $sDrive = $aArray[1] If StringLeft($aArray[2], 1) == "/" Then $sDir = StringRegExpReplace($aArray[2], "\h*[\/\\]+\h*", "\/") Else $sDir = StringRegExpReplace($aArray[2], "\h*[\/\\]+\h*", "\\") EndIf $aArray[2] = $sDir $sFileName = $aArray[3] $sExtension = $aArray[4] If $sType = 1 Then Return $sDrive If $sType = 2 Then Return $sDir If $sType = 3 Then Return $sFileName If $sType = 4 Then Return $sExtension If $sType = 5 Then Return $sFileName & $sExtension If $sType = 6 Then Return $sDrive & $sDir If $sType = 7 Then Return $sDrive & $sDir & $sFileName Return $aArray EndFunc ;==>_SplitPath
Recommended Comments
There are no comments to display.