April 4, 200719 yr Could someone help me with a little disk "house-keeping" please? I'd like to delete all the "Thumbs.db" & "*.wizd.bookmark" files recursively from my shares (hopefully the user shares for simplicity, but by disk is fine too). I note that there is a "-R" recursive switch for the "rm" command, however unless I "cd" to the specific directory they don't seem to be removed with:- cd /mnt/disk1 rm Thumbs.* -R any ideas? Thanks, Mark.
April 4, 200719 yr Could someone help me with a little disk "house-keeping" please? I'd like to delete all the "Thumbs.db" & "*.wizd.bookmark" files recursively from my shares (hopefully the user shares for simplicity, but by disk is fine too). I note that there is a "-R" recursive switch for the "rm" command, however unless I "cd" to the specific directory they don't seem to be removed with:- cd /mnt/disk1 rm Thumbs.* -R any ideas? Thanks, Mark. find /mnt -type f -name "Thumbs.*" -print | xargs rm find /mnt -type f -name "*.wizd.bookmark" -print | xargs rm These two commands will do it... The find command recursively finds the files and the output is then piped to xargs which invokes the rm command on the files. If you feel brave you can do both at the same time. (note you must use the back-slashes and parens to group the logic) find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print | xargs rm If you feel a bit less brave you can use the echo command rather than the "rm" command to initially test your syntax and not actually remove any files, but instead echo their names to the console as in the following example: find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print | xargs echo Only the files you want removed will be printed. Then, use the up-arrow on the keyboard, edit the test command replacing the echo command at the end with rm, and off you go.
May 3, 200719 yr Author Hi again Joe, I only just plucked up courage to tidy up my server with these commands and I find that ""xargs" doesn't seem to be a valid command under UnRaid? -bash: xargs: command not found - Any ideas? Thanks, Mark.
May 3, 200719 yr xargs was removed in one of the betas, but is back in beta10. Yep, got a little aggressive in pruning out unneeded programs...
May 9, 200719 yr Author Why the need for doing this? Just wondering if I should start... No real reason for the thumbs files, but the wizd bookmark files I'm accumulating are getting annoying, it's difficult to get back to the start of a film in Wizd, everytime I go to watch something someone has seen previously it starts with the end credits. Mark.
June 1, 200917 yr Author Waking up an old thread here, but I'm having some difficulties.... Could someone help me with a little disk "house-keeping" please? I'd like to delete all the "Thumbs.db" & "*.wizd.bookmark" files recursively from my shares (hopefully the user shares for simplicity, but by disk is fine too). I note that there is a "-R" recursive switch for the "rm" command, however unless I "cd" to the specific directory they don't seem to be removed with:- cd /mnt/disk1 rm Thumbs.* -R any ideas? Thanks, Mark. find /mnt -type f -name "Thumbs.*" -print | xargs rm find /mnt -type f -name "*.wizd.bookmark" -print | xargs rm These two commands will do it... The find command recursively finds the files and the output is then piped to xargs which invokes the rm command on the files. If you feel brave you can do both at the same time. (note you must use the back-slashes and parens to group the logic) find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print | xargs rm If you feel a bit less brave you can use the echo command rather than the "rm" command to initially test your syntax and not actually remove any files, but instead echo their names to the console as in the following example: find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print | xargs echo Only the files you want removed will be printed. Then, use the up-arrow on the keyboard, edit the test command replacing the echo command at the end with rm, and off you go. This strategy seems to work fine, unless there is a space in the folder name. When I originally did this the majority of my media folders didn't have a space in the name. What's odd is that if I use xargs echo the relevant files are listed, but using xargs rm I get errors as below find -type f -name "Thumbs.*" -print | xargs echo Result: ./My Movie 1/Thumbs.db ./My Movie 2/Thumbs.db ./My Movie 3/Thumbs.db find -type f -name "Thumbs.*" -print | xargs echo Result: rm: cannot remove `./My': No such file or directory rm: cannot remove `Movie': No such file or directory rm: cannot remove `1/Thumbs.db': No such file or directory rm: cannot remove `./My': No such file or directory rm: cannot remove `Movie': No such file or directory rm: cannot remove `2/Thumbs.db': No such file or directory rm: cannot remove `./My': No such file or directory rm: cannot remove `Movie': No such file or directory rm: cannot remove `3/Thumbs.db': No such file or directory Does anyone have a solution that would work with folder names that contain spaces? Many thanks, Mark. PS. Using 4.5-beta1 (rolled back to my last know good version as latest version version didn't display files on my Media Player)
June 1, 200917 yr Waking up an old thread here, but I'm having some difficulties.... Could someone help me with a little disk "house-keeping" please? I'd like to delete all the "Thumbs.db" & "*.wizd.bookmark" files recursively from my shares (hopefully the user shares for simplicity, but by disk is fine too). I note that there is a "-R" recursive switch for the "rm" command, however unless I "cd" to the specific directory they don't seem to be removed with:- cd /mnt/disk1 rm Thumbs.* -R any ideas? Thanks, Mark. find /mnt -type f -name "Thumbs.*" -print | xargs rm find /mnt -type f -name "*.wizd.bookmark" -print | xargs rm These two commands will do it... The find command recursively finds the files and the output is then piped to xargs which invokes the rm command on the files. If you feel brave you can do both at the same time. (note you must use the back-slashes and parens to group the logic) find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print | xargs rm If you feel a bit less brave you can use the echo command rather than the "rm" command to initially test your syntax and not actually remove any files, but instead echo their names to the console as in the following example: find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print | xargs echo Only the files you want removed will be printed. Then, use the up-arrow on the keyboard, edit the test command replacing the echo command at the end with rm, and off you go. This strategy seems to work fine, unless there is a space in the folder name. When I originally did this the majority of my media folders didn't have a space in the name. What's odd is that if I use xargs echo the relevant files are listed, but using xargs rm I get errors as below find -type f -name "Thumbs.*" -print | xargs echo Result: ./My Movie 1/Thumbs.db ./My Movie 2/Thumbs.db ./My Movie 3/Thumbs.db find -type f -name "Thumbs.*" -print | xargs echo Result: rm: cannot remove `./My': No such file or directory rm: cannot remove `Movie': No such file or directory rm: cannot remove `1/Thumbs.db': No such file or directory rm: cannot remove `./My': No such file or directory rm: cannot remove `Movie': No such file or directory rm: cannot remove `2/Thumbs.db': No such file or directory rm: cannot remove `./My': No such file or directory rm: cannot remove `Movie': No such file or directory rm: cannot remove `3/Thumbs.db': No such file or directory Does anyone have a solution that would work with folder names that contain spaces? Many thanks, Mark. PS. Using 4.5-beta1 (rolled back to my last know good version as latest version version didn't display files on my Media Player) If you use the -print0 option in find, instead of -print, and use -0 as an option to xargs, it should work as you desire. -print0 will print null terminated file names, and -0 in axrgs will look for the null characters terminating the file names. So... thy this version that will deal with the spaces in the names. find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print0 | xargs -0 rm
June 1, 200917 yr Author If you use the -print0 option in find, instead of -print, and use -0 as an option to xargs, it should work as you desire. -print0 will print null terminated file names, and -0 in axrgs will look for the null characters terminating the file names. So... thy this version that will deal with the spaces in the names. find /mnt -type f \( -name "Thumbs.*" -o -name "*.wizd.bookmark" \) -print0 | xargs -0 rm I was a little to nervous to do that whole lot in one go so based on the info you provided I did the following:- cd /mnt/disk1 find -type f -name "*.wizd.bookmark" -print0 | xargs -0 rm find -type f -name "Thumbs.*" -print0 | xargs -0 rm Note: reports rm: missing operand if no matching files present Worked a treat, Thanks Joe, Mark.
Archived
This topic is now archived and is closed to further replies.