LinuxQuestions.org - ghostdog74
LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Old

Simple Mass File Renamer & Deleter [Python]

Posted 09-17-2008 at 01:01 PM by ghostdog74
I am so bored today, that i started creating a command line batch file renamer, tested on Linux with Python 2.4.
Some of the simple things it can do is:
1) Change upper case to lower case and vice versa
2) Change file names by pattern substitution
3) Change file names by number sequence
4) Insert pattern in front of files
5) Insert pattern at the end of files.
6) Simple sort by number.
7) Manual revert of changed files.
8) Deletion...
Member
Posted in Uncategorized
Views 201 Comments 0 ghostdog74 is offline Edit Tags
Old

Simple Hangman Game

Posted 09-16-2008 at 07:35 AM by ghostdog74
I was so bored today, that i created this simple hangman game to entertain myself. Makes use of a dictionary file called "english" to get random word to guess. No fancy stuff like drawing the man, only number of tries (set to 10)

Code:
#!/bin/bash

awk  'BEGIN{
    dictfile="english"
    l="abcdefghijklmnopqrstuvwxyz"
    while (1) {
        srand()
        lm=split(l,letters,"")
...
Member
Posted in Uncategorized
Views 36 Comments 0 ghostdog74 is offline Edit Tags
Old

Mass File Renamer: Changing Cases(Upper/Lower)

Posted 09-13-2008 at 10:50 PM by ghostdog74
Code:
#!/bin/bash
## Change file names into uppper/lower case, or by position.
NO_ARGS=0 
E_OPTERROR=65
DEBUG=0
UPPER=0
FNAME="f"
maxdepth=1
directory=`pwd`
set -o noglob
#---- Functions ------------#

usage() {
 printf "Usage: `basename $0` [-D directory] [-M depth] [-U ] [-p pattern] [-c position ][-d] [-X] [filename(s)]\n"
 cat << EOF
        -D : starting directory.
...
Member
Posted in Uncategorized
Views 111 Comments 0 ghostdog74 is offline Edit Tags
Old

Mass File Renamer: By Pattern Substitution

Posted 09-13-2008 at 10:37 PM by ghostdog74
Code:
#!/bin/bash
## Change file names with a pattern substitution.
NO_ARGS=0 
E_OPTERROR=65
DEBUG=0
FNAME="f"
maxdepth=1
directory=`pwd`
set -o noglob

#---- Functions ------------#

usage() {
 printf "Usage: `basename $0` [-D directory] [-M depth] [-s pattern_from ] [-e pattern_to ] [-d] [-X] [filename(s)]\n"
 cat << 'EOF'
        -D : starting directory. Default=current
...
Member
Posted in Uncategorized
Views 63 Comments 0 ghostdog74 is offline Edit Tags
Old

Mass File Renamer: By Number Sequence

Posted 09-13-2008 at 10:19 PM by ghostdog74
Code:
#!/bin/bash
## Change file names into a sequence of numbers.
NO_ARGS=0 
E_OPTERROR=65
DEBUG=0
FNAME="f"
maxdepth=1
directory=`pwd`
set -o noglob

#---- Functions ------------#

usage() {
 printf "Usage: `basename $0` [-D directory] [-M depth]  [-s startseq] [-e endseq] [-p pattern] [-d] [-X] [filename(s)]\n"
 cat << EOF
        -D : starting directory. Default=current
...
Member
Posted in Uncategorized
Views 92 Comments 0 ghostdog74 is offline Edit Tags


All times are GMT -5. The time now is 01:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Open Source Consulting | Domain Registration