[HW] Script so that when i execute the "rm" command

Hi guys,

I need to write a script so that when i execute the "rm" command, the file mentioned need to be copied to other folder and then be deleted. this should be done in back ground. can you please help me out??

I have written a code in c for this but i dont have C compiler and i dont have admin rights to install too.

 #include<stdio.h>
  #include<unistd.h>
  #include<fcntl.h>
  #include<sys/types.h>
  #include<string.h>
   
  int main(int argc, char *argv[])
   
  {
              if(argc <= 1)
              {
                          printf("specify the file to be removed\n");
                          printf("exiting\n");
                          exit(0);
              }
              execlp("cp","cp",argv[1],/usb_hdd1/deleted_files,NULL);
              execlp("rm"."rm",argv[1],NULL);
              return 0;
  }           
  

The above is the code i have written. can i have something like this in shell??