Hi Peter, I think that the command you give: find . -name "* *" -type f | rm *.* -v
will indeed find all files named (anything1)(space)(anything2) - *however* : it will pass the names to "rm *.* which will ignore them and delete all files named (anything1)(dot)(anything2) ! (Which correspnds to what you reported ) :-( Even if you said find . -name "* *" -type f | rm -v it would not do what you want as rm would look for two files called anything1 and anything2 , seeing the space as a separator. Being an old school find-user (didn't have -delete back in the day) I would say find . -name "*.* -print0 | xargs -0 rm -v [or rm -iv if paranoid] The -print0 causes find to delimit each name with a null character and xargs -0 will use that null byte as a separator so that filenames wiht spaces will be treted as a single item. best regards, 웃 Victor Churchill, Netley Abbey, Southampton On Thu, 2 Dec 2021 at 15:12, PeterMerchant <petermerch...@hotmail.com> wrote: > On 30/11/2021 15:42, PeterMerchant wrote: > > I thought that my backup software Freefilesync was not backing up files > with spaces in the names, so I found online a solution that changed all the > spaces to -. > > > > find . -name "* *" -type f | rename 's/ /-/g'^C > > > > Now I have just checked my backup and discovered that files with spaces > in them were copied, so my backup so contains two copies of many files > > > > 'file-1' and 'file 1'. > > > > > > Can someone advise me of a script like the above that I can run on my > backup disk to remove the files with spaces in the names? > > > > I expect to hear you shout "NOT A GOOD IDEA" but I'll take the > responsibility for the results, even if I have to clean off the backup and > start from new. > > > > > > Thanks, > > > > Peter > > > > > I have not got it right. I tried > > find . -name "* *" -type f | rm *.* -v > > and it removed all files with extensions, but not the files without > extensions, with no concern over whether there were spaces or not.. > > removed '1841 census Jane burkey.jpg' > removed '1841-census-Jane-burkey.jpg' > removed '1841 census John Burkey (10).pdf' > removed '1841-census-John-Burkey-(10).pdf' > > ls gives: (partly) > > '1783 Baptism Richard Burkey' 1789-Baptism-Thomas-Burkey-2 '2015 > Burkeys in Grays 192-com' 'Len Burkey' > 1783-Baptism-Richard-Burkey '1824 Baptism Jane Burkey 2' > 2015-Burkeys-in-Grays-192-com Len-Burkey > '1783 Baptism Richard Burkey-2' 1824-Baptism-Jane-Burkey-2 'Ancestry > Burkey trees' Messages > > P. > > > -- > Next meeting: Online, Jitsi, Tuesday, 2021-12-07 20:00 > Check to whom you are replying > Meetings, mailing list, IRC, ... http://dorset.lug.org.uk > New thread, don't hijack: mailto:dorset@mailman.lug.org.uk > -- Next meeting: Online, Jitsi, Tuesday, 2021-12-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk