# How to: Strip an HD backup from . (dot) files



## Deleted member 58914 (Oct 25, 2019)

If you are not using any hidden files at the folder you had backed up to an external HD, you can clean this folder and all its nested data from hidden files by using this:

```
find /path/to/folder/ -type f -name ".*" -delete
```


```
find /path/to/folder/ -type d -name ".*" -delete
```


```
find /path/to/folder/ -type l -name ".*" -delete
```

Type f is files, type d is directory and type l is link. It is a recursive search, the asterisk causes all files starting with "." to be removed instead of just files called "." Sudo or su is not needed. If necessary use a recursive chown.

*Do not run this at a home folder outside the external hd* as usually the system home folder (the one which you are using with your current freebsd installation) has dot files and folders which are important to the system or at least its applications.

*Again, be careful to not mistype this command or you may lose data.*


----------



## yuripv (Oct 25, 2019)

Sorry, but I dont't think this is helpful. HOWTOs are supposed to help with real use cases, and I don't see why anyone would need to delete the dotfiles in such a manner.

Anyway, why sudo? What is "system home folder"?


----------



## Deleted member 58914 (Oct 25, 2019)

I see your point. In my case it was because I had many hidden files with considerable size from a backup I had made from linux before coming to freebsd. In order for me not to search and delete each one of them, I did the above. I think it does not hurt to provide information as small as it may be. If others also think this thread is not useful, I can request an admin to remove it. I have other more useful how to's.

As for sudo, it is because I came from a linux background. I read I can also add myself to the wheel group and use su. Is su the preferred way in freebsd?

I will try to rewrite the "system home folder" part since it seems the way I wrote it became a little confusing. I tried to make a difference between a home folder stored in an external device (HD for example) and the home folder your use with your freebsd installation.


----------



## toorski (Oct 25, 2019)

となりの吸血鬼さん said:


> If you are not using any hidden files at the folder you had backed up to an external HD, you can clean this folder and all its nested data from hidden files by using this:


GJ in showing howto utilize "find"  command, for those who don't know better


----------



## Deleted member 58914 (Oct 25, 2019)

That is it toorski! I just wanted to help someone who may need this. I myself did not knew a while ago I could use find in that manner but thanks to freebsd I had to learn it. Back in linux I still needed deja dup or similar.


----------



## toorski (Oct 25, 2019)

となりの吸血鬼さん said:


> That is it toorski! I just wanted to help someone who may need this. I myself did not knew a while ago I could use find in that manner but thanks to freebsd I had to learn it. Back in linux I still needed deja dup or similar.



Right on!  I would strip those dot files from Linux back-up as you did. I would strip dot files from my FreeBSD user home directory backup as well, if I didn't need a full restore of that dir.


----------



## Beastie (Oct 25, 2019)

となりの吸血鬼さん said:


> As for sudo, it is because I came from a linux background. I read I can also add myself to the wheel group and use su. Is su the preferred way in freebsd?


Not necessarily. Both can be useful depending on the situation. You can't always trust people enough to give them root's password.

The thing here is that - regardless of the tool being used - it's not recommended to always run commands with higher privileges, especially when they are far-reaching commands like "find ... wildcard ... delete". A small typo and it'll be like shooting yourself in the foot with a machine gun.


----------



## Deleted member 58914 (Oct 25, 2019)

Oh, I see your point beastie.

As for it being a dangerous command if you do not type it right, yes; I guess I will add another warning note to my thread thanks to your hint. It works for me because I made a script with that, so I do not have to type it everytime.

Shooting my own foot with a machine gun was a funny way of saying it I think ^^, but it is true.


----------



## toorski (Oct 25, 2019)

となりの吸血鬼さん
Just, chown of your back-up dir to your user name. But, I think that you already know that. I like to live dangerously, so I play su a lot too, makes me feel important - heh


----------



## toorski (Oct 25, 2019)

となりの吸血鬼さん

良い人


----------



## Deleted member 58914 (Oct 25, 2019)

toorski said:


> となりの吸血鬼さん
> Just, chown of your back-up dir to your user name. But, I think that you already know that. I like to live dangerously, so I play su a lot too, makes me feel important - heh


I knew it but forgot to use, sorry. With chown, sudo or su are indeed not needed.

Funny way how you said su or sudo makes one feel important=D. It can be seen that way.


----------



## Deleted member 58914 (Oct 25, 2019)

toorski said:


> となりの吸血鬼さん
> 
> 良い人


そう思いますか？ありがとうございます！

By the way, I edited the thread with your suggestion. Thanks for it


----------

