i2i8 Posted January 31, 2014 Share Posted January 31, 2014 (edited) I need a working script client in the LAN,The LAN server to the client transfers often similar to C: c.txt or D: d.mp3 or E: here3 not use such file or folder, so I had to write a script to solve this , I hope, while the client script deletes these files and folders, then create an empty folder with the same name, and then create a file name exceeds 255 characters file in this empty Folder, to prevent server transfer files from being overwritten or deleted again, can you help me? I want to declare a constant, a constant value to different path of the file or folder, and give them the same permissions and attributes. Give them the +RSH permissions, EVERYONE read access. For example: Dim $FilesPath = "a" Here A I want to represent the path: c:test and d:a.dll and E:good.mp3 etc. such multiple paths When the $FilesPath value is specified in the file path, the removal of all their property, gives everyone all the permissions, and then, delete them Next For the $FilesPath specified that all files and folders +RSH attribute and give them the everyone read-only permissions I was just learning autoit3, can you help me how to write scripts to my request? Edited February 1, 2014 by i2i8 Link to comment Share on other sites More sharing options...
Danyfirex Posted January 31, 2014 Share Posted January 31, 2014 (edited) Look Into the help File Welcome to Autoit World Edit: I could be something like this: Local $A[3] = ["here Path1", "here Path2", "here Path3"] For $i = 0 To UBound($A) - 1 If FileExists($A[$i]) Then MsgBox(4096, $A[$i], "Exists") FileSetAttrib($A, "+RSH") Else MsgBox(4096, $A[$i], "Does NOT exists") EndIf Next saludos Edited January 31, 2014 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
i2i8 Posted January 31, 2014 Author Share Posted January 31, 2014 (edited) Thank you very much Danyfirex reply. I think it should be like this script But, soon, I found, this is wrong, help me how to write is correct can you? Local $FilesPath[3] = ["C:\c.txt", "D:\d.mp3", "E:\here3"] For $i = 0 To UBound($FilesPath) - 1 If FileExists($FilesPath[$i]) Then MsgBox(4096, $FilesPath[$i], "Exists") FileSetAttrib($FilesPath,"-RSH") RunWait(@ComSpec & ' /c ' & 'echo y|cacls.exe $FilesPath /P everyone:F','',@SW_HIDE) DirRemove($FilesPath) DirCreate($FilesPath) FileSetAttrib($FilesPath, "+RSH") RunWait(@ComSpec & ' /c ' & 'echo y|cacls.exe $FilesPath /P everyone:R','',@SW_HIDE) Else MsgBox(4096, $FilesPath[$i], "Does NOT exists") EndIf Next Edited January 31, 2014 by i2i8 Link to comment Share on other sites More sharing options...
Danyfirex Posted January 31, 2014 Share Posted January 31, 2014 I think you wanted to pass the path. so do it by this way. local $FilesPath[3] = ["C:\c.txt", "D:\d.mp3", "E:\here3"] For $i = 0 To UBound($FilesPath) - 1 If FileExists($FilesPath[$i]) Then MsgBox(4096, $FilesPath[$i], "Exists") FileSetAttrib($FilesPath,"-RSH") RunWait(@ComSpec & ' /c ' & 'echo y|cacls.exe ' & $FilesPath[$i] & '/P everyone:F','',@SW_HIDE) DirRemove($FilesPath) DirCreate($FilesPath) FileSetAttrib($FilesPath, "+RSH") RunWait(@ComSpec & ' /c ' & 'echo y|cacls.exe ' & $FilesPath[$i] & ' /P everyone:R','',@SW_HIDE) Else MsgBox(4096, $FilesPath[$i], "Does NOT exists") EndIf Next saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
i2i8 Posted January 31, 2014 Author Share Posted January 31, 2014 (edited) I need a working script client in the LAN,The LAN server to the client transfers often similar to C: c.txt or D: d.mp3 or E: here3 not use such file or folder, so I had to write a script to solve this , I hope, while the client deletes these files and folders, then create an empty folder with the same name, and then create a file name exceeds 255 characters documents within this empty file, to prevent server transfer files from being overwritten or deleted again, can you help me? Edited January 31, 2014 by i2i8 Link to comment Share on other sites More sharing options...
i2i8 Posted January 31, 2014 Author Share Posted January 31, 2014 I think you wanted to pass the path. so do it by this way. local $FilesPath[3] = ["C:\c.txt", "D:\d.mp3", "E:\here3"] For $i = 0 To UBound($FilesPath) - 1 If FileExists($FilesPath[$i]) Then MsgBox(4096, $FilesPath[$i], "Exists") FileSetAttrib($FilesPath,"-RSH") RunWait(@ComSpec & ' /c ' & 'echo y|cacls.exe ' & $FilesPath[$i] & '/P everyone:F','',@SW_HIDE) DirRemove($FilesPath) DirCreate($FilesPath) FileSetAttrib($FilesPath, "+RSH") RunWait(@ComSpec & ' /c ' & 'echo y|cacls.exe ' & $FilesPath[$i] & ' /P everyone:R','',@SW_HIDE) Else MsgBox(4096, $FilesPath[$i], "Does NOT exists") EndIf Next saludos I have tested this script, and can not do to prevent being deleted, the script created file or folder with the same name can still be deleted or overwritten Link to comment Share on other sites More sharing options...
i2i8 Posted February 1, 2014 Author Share Posted February 1, 2014 Yes, I want to pass the path and then, create a folder with the same name, and then in this folder, create a new file name longer than 255 characters, again to prevent the server to overwrite or delete Link to comment Share on other sites More sharing options...
i2i8 Posted February 1, 2014 Author Share Posted February 1, 2014 up…… Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now