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

Reply via email to