Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #check if there iz a backup subdirectory, and if there ain't make some
- if [ ! -d ./backup ]
- then
- mkdir ./backup
- fi
- #get all tha filez from tha current directory
- FILES=`ls -l | grep ^- | awk '{print $9}'`
- for file in $FILES
- do
- filename=`$file >> awk -F. '{print $1}'`
- #firstly copy all the files from the current directory and paste them in the subdirectory
- cp $file ./backup/$file
- #secondly rename them or rather change their extension to .backup
- mv ./backup/$file ./backup/${filename}.backup
- done
- touch modified.txt
- #so with the mtime command we can list all files/directories that have or have not been modified in the last x dayz
- echo "`find . -type f -mtime -1`" >> modified.txt
- cat modified.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement