 in most desktop environments when you delete a file it isn't deleted it's moved into a new folder on windows it's called the recycling bin on linux it's called the trash on apple i think it's called garbage and it probably looks something like that because apple's fancy that that's the drill but when you're in a shell and you delete a file it's basically like setting that file on fire it's pretty much not coming back you want to create a shell script that doesn't permanently delete a file you want to move it into the trash or the recycling or the garbage can we can do that and although pretty much these are just folders on your system i don't know if there's more to the process than just moving it into that folder luckily uh when i searched i found out that there is a way to properly move stuff into your trash can recycling bin garbage bin whatever you want to call it first off let me uh clarify that we are working with a linux desktop system here obviously if you're writing shell scripts and other systems they handle trash differently we are going to use a program called gio which is developed by the gnome project or gnome or gnome however you want to say it gio stands for gnome input output it's a library okay you may or may not have this on a system it's commonly installed these days on a lot of systems especially if you're running the gnome desktop i don't so i had to install it by myself separately it is in my repositories but it's not just under gio it's part of a package to install it on a debbie and base system it's sudo apt install lib glib 2 dot zero dash dev once you install that you will have gio which does a lot of different things and again we're just looking at using it for trash today so here is my trash i've emptied it there's nothing in there i'm in a folder with a couple of files if i gio trash and give it one of these file names now i can list out you can see that file is gone if i look at my trash you can see it's there i can click on that and restore it and now it is back so that is how you would use it just gio trash and the file name why would you want to do this well i'll give you a scenario on why i look this up the other day on how to do because most time if i need to delete something i just delete it i don't even think about trash most of the time in fact when i'm in my GUI interface in my file browser lots of times i'll hit shift delete which usually skips the trash can all together but i was writing a script let me type this out this is my script right here so what does this do so i work with the godot game engine a lot and for sound effects and stuff it's usually you want an aug file ogg file for the audio and a lot of times i'll download sound effects and they might be in another format and although you can use mp3 or wave formats godot just works well with g ogg files so i wrote this script that i will either give it a file name and an output or if i run the script without giving it it's going to prompt me to select a file it's going to list the files all the mp3's and waves in my current directory and then it will either ask me for an output or use that file name as an output just replacing the extension with ogg and then i'll use ffmpeg to convert that to an aug file so basically i'm just taking my mp3 or wave file and converting it to an aug file but lots of times when i do this i don't need or want the original files so i have here to ask if you want to remove the original file and i have the default but let's say i convert it and i click yes and then i go listen to it and for some reason it didn't convert right or i just didn't want to delete it i didn't i didn't want to lose that so now i check okay instead of saying delete i say trash gio so let's let's have a look at this script so again i'm in a directory here and i've got two mp3's and a wave file so all i have to do is type in um two aug and again i can give it a file name and an output name but if i don't it's going to use fzf to list files i can select one of these it converts it and then i can just hit enter here and it moves it to trash so again if i listed out you can see now it's been replaced with this ogg file let's do it to another one i can do it to this mp3 yes and i can do the wave file yes and then i can list out and you can see i now have converted them all to ogg files and if i was to go to my trash they're all right here if i go off i didn't want to delete the originals i can just say restore and when i go back over here i can list them out and now i have the mp3's the waves and the ogg file so that's a uh use case scenario for you but i do hope that you found this useful if you ever want to have a script that deletes files but you know sometimes it can be scary having a script delete files moving in a trash may be a better option again i've been using linux and writing shell scripts for 18 years now and i've never had to do this before but it could be a good practice but again this is specific to linux systems with gio installed so it may not be as compatible if you're moving to other systems such as uh windows or mac os because you know you can run bash natively on pretty much anything windows and mac and i believe bash is the default shell on mac os last time i checked or whatever they call their operating system uh so yeah you gotta think about that anyway i hope you found this useful please visit films by chris.com that's chris the k there's a link in the description and as always i hope that you have a great day