mod_files.sh [PHP]


/ Published in: Bash
Save to your folder(s)

here's a script, mod_files.sh, in ext/session for creating directory
tree with depth X for sessions. As it stands, it's pretty poorly
documented and very basic. I * got exceptionally bored and rewrote most
of it, the patch is attached. It runs fine for me in linux (with sh
version 4.0). I don't have any other *NIX systems to test it out on,
so I can't verify that it works in anything but linux, sorry.

* Eddie Drapkin


Copy this code and paste it in your HTML
  1. #! /bin/sh
  2.  
  3. if test "$2" = ""; then
  4. echo "usage: $0 basedir depth"
  5. exit 1
  6. fi
  7.  
  8. if test "$2" = "0"; then
  9. exit 0
  10. fi
  11.  
  12. hash_chars="0 1 2 3 4 5 6 7 8 9 a b c d e f"
  13. if test "$3" -a "$3" -ge "5"; then
  14. hash_chars="$hash_chars g h i j k l m n o p q r s t u v"
  15. if test "$3" -eq "6"; then
  16. hash_chars="$hash_chars w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - ,"
  17. fi
  18. fi
  19.  
  20. for i in $hash_chars; do
  21. newpath="$1/$i"
  22. mkdir $newpath || exit 1
  23. sh $0 $newpath `expr $2 - 1` $3
  24. done

URL: http://bugs.php.net/bug.php?id=49175

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.