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

  • Thread starter Deleted member 58914
  • Start date
D

Deleted member 58914

Guest
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:
Code:
find /path/to/folder/ -type f -name ".*" -delete
Code:
find /path/to/folder/ -type d -name ".*" -delete
Code:
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.
 
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"?
 
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.
 
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.
 
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.
 
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.
 
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.
 
となりの吸血鬼さん
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.
 
Back
Top