How to protect files/folders from being copied/moved/deleted/cut on Windows

39

To configure the drive to read-only you can use Microsoft's Diskpart like this (The "Attributes Readonly" function is available only on Windows 7):

  1. Open a Command line prompt and enter these commands
  2. Diskpart
  3. List Volume
  4. Select Volume <The volume letter of the external HD>
  5. Attributes Volume Set ReadOnly
  6. Attributes Disk Set ReadOnly

This should protect your external HD from any changes. As for coping files from you EHD to a local computer, I don't think you can control it - if he can read it he can copy it.

Another option is to put on your HD a bootable OS (probably Linux would be a good place to look for), that blocks all local HDs and encrypt everything on the EHD, so it can be accessed only through this specific OS.

I've read that this thing can be done with Windows 8, but I've no online sources to give you.

Share:
39

Related videos on Youtube

Sean Lee
Author by

Sean Lee

Updated on September 18, 2022

Comments

  • Sean Lee
    Sean Lee almost 2 years

    I have variable called out and I stored value there is:

    b'0,0.0372549,0.00653595,0,0.00490196,0.00653595,0.897386,0.00653595,0.0294118,0.00653595,0,0,0,0,0,0.00490196,0,0,0,0\n0,0.0158333,0.0179167,0.00277778,0.116111,0.327083,0.0265278,0.174167,0.0623611,0.116806,0.055,0.0270833,0,0,0.01875,0.0333333,0,0,0,0.00625\n0,0.997554,0.00133297,4.75327e-05,0.000118379,6.65359e-05,0.000253487,0.000141784,0.000183293,0.000220498,7.08961e-05,0,0,0,0,0,1.10967e-05,0,0,0\n0,0.082346,0.890084,0,0.000346861,0.0161043,0.0105323,0.000354988,0.00011562,0.00011562,0,0,0,0,0,0,0,0,0,0\n0,0.654957,0.306633,0,0.00150356,0.000466853,0.00273321,0.000933707,0.00233427,0.00186741,0,0,0,0,0.0190476,0.00952381,0,0,0,0\n0,0.429955,0.0543849,0.106071,0.0297159,0.0876241,0.16761,0.0435997,0.0293692,0.0167052,0.00492931,0.0143504,0.00664048,0.00127352,0.000520984,0.00405789,5.78871e-05,0,0,0.00313481\n0,0.372212,0.459023,0.00909091,0.0183902,0.00273224,0.0897315,0.00666667,0.0163417,0.000546448,0.000208333,0.00929924,0.00666667,0,0,0,0,0,0,0.00909091\n0,0.916784,0.0557399,0.00127288,0.0044239,0.00263795,0.00418008,0.00522153,0.00448012,0.0016537,0.0015471,0.00140777,0.00011532,4.21977e-05,4.21977e-05,5.76602e-05,0,0,0,0.000393295\n0,0.817223,0.10791,0.0119181,0.00617358,0.00279979,0.027469,0.00652177,0.00186348,0.00522515,0.0121172,0.000151166,0,0,0,0,0.00017316,0,0,0.000454545\n'

    Now I am writing following code:

    for p in out.rstrip().split('\n'):
        print(p)
    

    Now I am getting following error:

    TypeError: a bytes-like object is required, not 'str'

    How to solve this error ? I tried unicoding but doesn't work. what would be the for loop code to get desired output.

  • nixda
    nixda over 10 years
    it's available only on Windows 7. Huh? Diskpart is one of Microsoft's oldest tools. It was and is included in all versions since Windows 2000
  • EliadTech
    EliadTech over 10 years
    That is correct, but this specific function is new.
  • Admin
    Admin almost 6 years
    According to your code b is coming at first, I don't want that.
  • theonlygusti
    theonlygusti almost 6 years
    You are removing byte statement manually. That is not correct
  • Carlo Beccarini
    Carlo Beccarini almost 6 years
    Read better what i said :)
  • Carlo Beccarini
    Carlo Beccarini almost 6 years
    Since you're not giving us complete needs, i'm gonna guess the solutions, and btw the last solution is what you're looking for, it will still be a byte statemnent.
  • Carlo Beccarini
    Carlo Beccarini almost 6 years
    he just need to use splitlines() instead of split('\n'), since it is used for str-objects not byte-like objects.
  • Patrick Maynard
    Patrick Maynard almost 6 years
    This should work to get rid of byte b'' at the beginning you must decode the string
  • Admin
    Admin almost 6 years
    both are incorrect. I want just the values not b before any string. you written foo by removing the character b from the front.
  • Carlo Beccarini
    Carlo Beccarini almost 6 years
    Well, i'm gonna call. You're question doesn't say that. Fix it.
  • Carlo Beccarini
    Carlo Beccarini almost 6 years
    We both answered your question. Please, edit you question if you need anything else from what you asked.
  • Dimosthenis
    Dimosthenis almost 6 years
    If you don't want to decode the string then split it with out.rstrip().split(b'\n'). That is b'\n' instead of '\n'