Linux shell script delete

Hi Everyone

I am beginner and I will really appreciate if I receive any help

I want to create linux shell script " delete" that will :
1 create folder "dustbin" if it exists then do nothing
2 move any file that I want to delete from random location into the "dustbin" folder and remember its location for in case I would like to restore it

That's what I now and did so far:

#!/bin/sh
#this is a Delete script
mkdir -p "DUSTBIN"
#!/bin/sh

echo "please enter the directory name.........."
read dir  #yu have t enter dirrectory as DUSTBIN

 
        if ! [ -d "$dir" ] 
        then
                echo " $dir is not exist, so going to create $dir"
		mkdir -p $dir
       else
               echo "$dir already  exists"
        fi

       

mv *temp $dir 

Is this homework?

I am still quite fresh user of linux and I wanted to clean my pc, instead of deleting all files completely I wanted to put some of them that I will think I may need in future into the dust bin :slight_smile:

Better to get a good backup of the OS and all the data files not included in the OS backup. Keep the media safe and remove the files.

If it all goes wrong, restore using your DR procedure if required for an OS file of from your general data media for other files.

You are over complicating things, but do test your OS backup first. Remember that even if you save files to a "dustbin", you have to have a running system to put them back with.

Robin
Liverpool/Blackburn
UK