Cant remove thumbs.db from SMB Share

Status
Not open for further replies.

bent98

Contributor
Joined
Jul 21, 2017
Messages
171
I use my windows box to delete files and folders from my FreeNas 11 U2 server. I mapped my windows 10 box to freenas via SMB shares. When I try to delete a folder, there sometimes is a hidden file called thumbs.db inside. Windows gives me an erroring telling me i cant delete the thumd.db file as its open in windows explorer. I went through a tutorial to make sure windows doesnt create the thumbs.db file in the future but my issue
https://www.hardanswers.net/stop-thumbs-db-from-locking-folder-deletion-renames


My issue is remove the already created folders with the thumbs.db in them? I searched the forums and found some threads on this topic but I couldn't quite grasp what the fix was. I work in windows mostly so I am a linux/Unin newbie.

Any help is much appreciated.
 
Last edited:

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
Aren't the thumbs.db files created by windows because they contain required metadata for the browsing of files? That is probably why the system doesn't want you deleting them.

Why do you want to get rid of them? They are trivial in size no?
 

bent98

Contributor
Joined
Jul 21, 2017
Messages
171
Because the thumb.db resides inside the folder I want to delete. I have about 70 folders I need to get rid of.
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
My issue is remove the already created folders with the thumbs.db in them? I searched the forums and found some threads on this topic but I couldn't quite grasp what the fix was. I work in windows mostly so I am a linux/Unin newbie.

Run this on the command line

Code:
find / -name "Thumbs.db" -delete
 

bent98

Contributor
Joined
Jul 21, 2017
Messages
171
Will that just delete the thumb.db file and not the folder or any other files inside that folder other than thumb.db? I want to make sure i dont run that i delete half my files.

I tried that command without the -delete statement and it pickup up a ton of thumb.db's
 
Last edited:

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
Will that just delete the thumb.db file and not the folder or any other files inside that folder other than thumb.db? I want to make sure i dont run that i delete half my files.

I tried that command without the -delete statement and it pickup up a ton of thumb.db's

Take a look here for the man pages for the find command. So far you have determined that you have a lot of such files. If you don't want to delete all of them at one fell swoop you'll have to decide how to use the path to limit the scope of the find command.
 

bent98

Contributor
Joined
Jul 21, 2017
Messages
171
I want to delete all the thumb.db , I just want to make sure it doesn't delete the folders or other files inside the folder where the thumb.db resides . Can you confirm it will just delete hat file and nothing else?
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
I want to delete all the thumb.db , I just want to make sure it doesn't delete the folders or other files inside the folder where the thumb.db resides . Can you confirm it will just delete hat file and nothing else?

That's my understanding of how the find command will work. If you don't have backups or have some other concern, I suggest you set up a handful of test folders, put a small test file of the same name in each and run the command on that test file set to determine if the result is the one you wish to achieve.
 

bent98

Contributor
Joined
Jul 21, 2017
Messages
171
Ok thanks. One more question. I will be building another free as server and I want to transform the entire contents from one to their other. What's the best way to do that?
 

Redcoat

MVP
Joined
Feb 18, 2014
Messages
2,925
Ok thanks. One more question. I will be building another free as server and I want to transform the entire contents from one to their other. What's the best way to do that?

rsync is one, snapshots and replication is/are another - latter typically for backup and rapid selective restore capability. Do a search here - there are many postings addressing these topics.
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
Why not just SSH into your server and run a "rm -r" command specifying "*.db"? (WARNING: double and triple check your rm command as there is no undo and mistakes can happen easily with typos).

If you are transferring from one FreeNAS server to another, I have always used snapshots and replication with great results.
 
Status
Not open for further replies.
Top