Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #del
- #check arguments
- if [ "$1" == "" ]; then
- echo "No file given"
- exit 1
- fi
- #check dustbin
- if [ ! -d /root/my-applications/bin/dustbin ]; then
- mkdir /root/my-applications/bin/dustbin
- fi
- for file in $@;
- do
- #file name
- name=`basename "$file"`
- #dir name
- destination=`dirname "$file"`
- if [ ! -d $destination ]; then
- pwd=`pwd`
- touch /root/my-applications/bin/dustbin/path$name && echo >> "$pwd"
- else
- touch /root/my-applications/bin/dustbin/path$name
- echo $destination >> /root/my-applications/bin/dustbin/path$name
- fi
- if [ -f $file ]; then
- mv $file /root/my-applications/bin/dustbin
- echo "File $file deleted"
- else
- echo "File $file does not exist"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement