yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Setting File Attributes To Hide Your Files


4m read
·Nov 3, 2024

Hey guys, there's mad kids on today. I'm going to be showing you something on setfile, which allows you to set file attributes on Finder files.

Um, what I mean by this is that Finder treats files in a certain way that might be different to how the actual operating system would treat them, involving specific flags on the file. Because file permissions not only have who owns the file, etc., it also has different flags that you can set on the file, like "Is this file hidden?" "Is the system file?" etc.

And Apple has put a nice little terminal command in the OS called setfile, which allows us to set these attributes quickly and efficiently through our own little terminal. So first of all, you want to open up Terminal, however you get to it, or you can open up your own terminal application, but this will work the same in any terminal.

So now, when you type setfile (ok with the capital S and a capital F), and if you hit Enter, I'll show you the help for that command. So first of all, I'm going to create a file on my desktop, and I'm going to make it hidden. So I'm just going to do a cut here while I make a file.

Ok, so now on my desktop, I have a file called "file" right here, and I'm just going to make that file invisible. So what you want to do is type setfile with the capital S and the capital I. Ok, space, dash a, space, quote capital V, close quotes, space. Then you want to drag in the file or folder or some folders too and just hit enter.

And now the file is still there on my desktop; it's just gone. And if I create a new tab here and type cd desktop, then type ls, the file is still there, right there. So it exists, it just doesn't show anywhere on your desktop.

So now I'm going to also set this up to unhide it. You do the exact same command; the V inside of the quotes is lowercase instead of capital. So that way it works out. Now I’ll hit enter, and so the file is back—it's the same file, still 0 bytes.

Okay, but um, so that’s how to hide a file with setfile. The next thing I'm going to be showing you how to do is make it locked, so that way Finder won't let you delete it even if you are the owner of it; it's like a password protection. So now type—I’ll just type setfile space a space quote capital L, close quote, space, and then you drag it to the file or folder and hit enter.

So now, right here, you see next to this file there's a little lock right there next to the file, and that means it's a system file. So I can open it up and edit, but if I type in here and try saving, it says "File's locked. Do you want to overwrite?" and I'll just click "Overwrite," but basically it just warns you about that kind of stuff.

Then if I try to delete it, it says "Finder's locked. Do you want to move it to the trash anyway?" You can click "Continue," but then if I try to empty my trash, wait, "Empty trash," it won't let me, and I have to click on the trash bin or use "Force empty trash" through terminal. Hold option, local, then I'll empty my trash.

So I'm going to recreate that file on my desktop so I can show you how to unlock a file. Okay, so I've got this locked file here. So if you use a lowercase l instead of a capital L in the same terminal command, like I will do right here, then simple enough, it's unlocked now.

Now say I want to make it so they can't rename the file even if it's locked, okay? So it's setfile space dash a, and I'll just do sudo. You have to do sudo if you're going to make it a system file, and then you drag in the file. Now I'll type in my password.

Okay, so now you can't rename the file. Now if you make that a lowercase s, you can rename a file. I will also point out that the file has to have something in it. So that's how to lock a file, make a file a system file, hide the file.

So now I'm going to just show you how to get more information on this command: type man space setfile, and the S and the F are capitalized. Now you can use the F key to move down in the keys to move up. Right here under dash a, attribute, so you can see you can go down instead of custom icon. You can see the system file locks, the name, invisible, busy. You can set the date on the file to be whatever you want to trick your friends into thinking and kind of file for longer than you have.

Get file info will get the info. [Music] Here’s an example of setting the update. You can set—um, yeah, that’s pretty much it. So that is—um, it—you can do, e is hiding the extension located on the desktop. But the—and that’s to get files on your desktop, even if they’re not there. Well, they’re as a bundle somewhere, whether it’s an alias or whatever.

Um, alright, so you can just press Q to get out. So now click my terminal application called "The Lincoln File." But I will point out one last thing: that setfile is a very nice little tool, and you should never trust dates on files again because now all your friends know how to set a date on the file, but that's pretty cool.

So thanks for watching, my kids, and one subscribe and goodbye.

More Articles

View All
Simulating samples from populations example 1 | Grade 8 (TX) | Khan Academy
We’re told a company manager wants to estimate the mean amount of time it takes the employees to travel to work. Here’s what the manager did: Survey the first 20 employees to arrive that day. Note the amount of time for each employee, add those times, a…
Animal Storm Squad: Saving Pets From Natural Disasters | Nat Geo Live
Karissa: Almost three years ago, my life changed. A powerful EF-5 tornado ripped through Moore, Oklahoma, which, tragically, killed twenty people. That day, my friend Dave Holder, he’s a Meteorologist, and he called me about forty-five minutes after the t…
Using associate property to simplify multiplication
In this video, we’re going to think about how we can use our knowledge of multiplying single-digit numbers to multiply things that might involve two digits. So, for example, let’s start with what is 5 times 18. You can pause the video and see how you mig…
Elad Gil Shares Advice from the High Growth Handbook, a Guide to Scaling Startups
The first question I wanted to ask you: the book is called High-Growth Handbook, not the High-Growth Hanjo, just High-Growth Handbook. Given that so few companies ever make it to high growth, you know, thousands of employees, why should an average entrepr…
Why I'm a Financial Minimalist
What’s up you guys? It’s Graham here. So this is something I’ve never directly addressed before. I’m gonna be getting a lot deeper than I usually go in these types of videos. So let’s just get right into it. This video is being made because several of yo…
The Fastest Way To Find Waldo
Here’s how to become scary good at finding Waldo. In 2015, data scientist Randall Olssen used all 68 of Waldo’s hiding spots in the seven primary books to build this kernel density estimate. So where’s Waldo really? He’s here! Now, there are more ways t…