0

After multiplie tries, I've come up with no solution. I don't think you can manually just lock a folder and put a password assigned to it if that makes sense. I think you can, lock a folder using a password. But manually changing the permissions of the folder, (when you right click and go to security tab and deny every user to accessing the folder, aka denying everyone to modify and read & execute etc) what im trying to understand is how would you go about using python to deny everyone permissions on a windows folder?

My actual gui is pyqt4 but its sorted. I just dont understand how to set permissions on folders in windows 10. Thank you in advance.

Basic steps in my application.

Select folder (Done) Enter password (Done) Click lock folder button (Done) Sets permissions to deny access (Need help)

And when you want to unlock the folder

Select folder (Done) Enter password (Done) Click unlock folder button (Done) Removes deny permissions (Need help)

  • Possible duplicate of [Setting folder permissions in Windows using Python](http://stackoverflow.com/questions/12168110/setting-folder-permissions-in-windows-using-python) – Josh Lee Apr 04 '17 at 16:44
  • @JoshLee I did see that, but couldn't make sense of it. –  Apr 04 '17 at 17:39
  • I added an [alternate answer](http://stackoverflow.com/a/43244697/205580) that may make more sense to you. It's at least a more proper solution in general. – Eryk Sun Apr 06 '17 at 02:54

1 Answers1

0

WE can actually do that stuff and here are the procedures:

  1. Right-click inside the folder where the files you want to protect are located. The folder you want to hide can even be on your desktop.
  2. Select "New" from the contextual menu.
  3. Click on "Text Document."
  4. Hit Enter. It doesn't matter what the file will be named. You can delete this text file once the lockable folder has been made.
  5. Double-click the text file to open it.

  6. Paste the below text into the new document:

    cls
    
    @ECHO OFF
    
    title Folder Locker
    
    if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
    
    if NOT EXIST Locker goto MDLOCKER
    
    :CONFIRM
    
    echo Are you sure u want to Lock the folder(Y/N)
    
    set/p "cho=>"
    
    if %cho%==Y goto LOCK
    
    if %cho%==y goto LOCK
    
    if %cho%==n goto END
    
    if %cho%==N goto END
    
    echo Invalid choice.
    
    goto CONFIRM
    
    :LOCK
    
    ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    
    attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    
    echo Folder locked
    
    goto End
    
    :UNLOCK
    
    echo Enter password to Unlock folder
    
    set/p "pass=>"
    
    if NOT %pass%==Your-Password-Here goto FAIL
    
    attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    
    ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
    
    echo Folder Unlocked successfully
    
    goto End
    
    :FAIL
    
    echo Invalid password
    
    goto end
    
    :MDLOCKER
    
    md Locker
    
    echo Locker created successfully
    
    goto End
    
  7. Find where it says "Your-Password-Here" in the document.

    1. Replace "Your-Password-Here" with the password you want to lock the folder with.
  8. Click File.

  9. "Select Save As..."

  10. Click on the "Text Documents (*.txt)" menu bar that's next to "Save as type:"

  11. Select "All Files"

  12. Change the file name to "FolderLocker.bat"
  13. Click "Save."

  14. Double-click FolderLocker.

  15. Fill the Locker folder with the items you want to protect.

  16. Open the FolderLocker file, because it's time to lock that folder up!

  17. Type "Y" into the screen.

  18. Click Enter, and the Folder Locker window will disappear, along with the Locker folder itself! Your secrets are safe!

To unlock the folder, double-click "FolderLocker" to open it. Enter the password you entered in Step 8, and click Enter.

The Locker folder is back. You can open it to find your hidden files. Repeat Steps 17, 18 and 19 to lock the folder again.

Accountant م
  • 6,975
  • 3
  • 41
  • 61