Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.52 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ -d "$1" ]
  4. then
  5.  
  6.         x=( $(find $1 -mtime -1 -ls | tail -n +2 | cut -d ' ' -f 26) )
  7.  
  8.         len=${#x[@]}
  9.  
  10.         d=$(date '+%d')
  11.         m=$(date '+%m')
  12.         y=$(date '+%Y')
  13.  
  14.         #for i in ${x[@]}; do echo $i; done
  15.  
  16.         if [ -d "$2" ]
  17.         then
  18.                 for i in ${x[@]}; do cp $i $2; done
  19.         else
  20.                 mkdir ./$2
  21.                 for i in ${x[@]}; do cp $i $2; done
  22.         fi
  23.         for file in $2/* ;do mv $file ${file}_"$d"_"$m"_"$y" ; done
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement