Reputation: 2158
I have a directory with numerous zip files on Google drive. Some of those files have been extracted. Now the drive space is full so I need to clean up space. So I want to delete those zip files which have already been extracted. I'm using this command
!for x in `find "drive/My Drive/Refrence_Downloaded/" -maxdepth 1 -type d`; do rm $x.zip; done
But due to the space in the name "My Drive", find
command splits the name into two paths. As it is Google drive, I cannot change it's name. How do I fix this?
Upvotes: 0
Views: 259
Reputation: 22311
@HarshWardhan : The find
command itself does not split anything. The problem occurs when you do a
rm $x.zip
and x
holds a path containing spaces. In this case, bash will split the arguments before handing them over to rm
. Hence you need to avoid a
rm "$x.zip"
a word splitting.
Upvotes: 1