โ02-08-2023 04:07 AM
How can I delete a file in DBFS with Illegal character?
Someone put the file named "planejamento_[4098.]___SHORT_SAIA_JEANS__.xlsx" inside the folder /FileStore and I can delete it, because of this error: java.net.URISyntaxException: Illegal character in path at index 24.
I used: dbutils.fs.rm("/FileStore/planejamento_[4098.]___SHORT_SAIA_JEANS__.xlsx")
โ02-17-2023 04:23 AM
try this
%sh
ls -li /dbfs
if the file is located in a subdirectory you can change the path mentioned above.
the %sh magic command gives you access to linux shell commands.
โ02-08-2023 04:49 AM
you can try to use the %sh magic command and use rm.
Combined with this little help, it will probably work.
โ02-16-2023 04:39 AM
Thank you. I tried all the commands but none of them worked because the characters are "[" and "]". ๐ฉ
โ02-16-2023 05:00 AM
it should still be possible.
can you try using ls -li (or ls -ia) first to get a list of files, then use the inode number (first column) and use it in the find- delete command:
> ls -li
> find . -inum <inodenumber> -delete
you can try without the -delete first to see if the file can be found
โ02-16-2023 12:13 PM
โ02-17-2023 04:23 AM
try this
%sh
ls -li /dbfs
if the file is located in a subdirectory you can change the path mentioned above.
the %sh magic command gives you access to linux shell commands.
โ02-17-2023 04:39 AM
Thank you!
It worked out!
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group