Jump to content

Recommended Posts

Posted (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 by i2i8
Posted (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 by Danyfirex
Posted (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 by i2i8
Posted

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

Posted (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 by i2i8
Posted

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

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...