LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Blogs > ghostdog74
User Name
Password

Notices


Uncategorized Entries with no category
Old
Rating: 48 votes, 4.92 average.

Simple Mass File Renamer & Deleter [Python]

Posted 09-17-2008 at 12: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...
Senior Member
Posted in Uncategorized
Views 10578 Comments 0 ghostdog74 is offline
Old
Rating: 2 votes, 3.00 average.

Simple Hangman Game

Posted 09-16-2008 at 06: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,"")
...
Senior Member
Posted in Uncategorized
Views 2429 Comments 0 ghostdog74 is offline
Old
Rating: 2 votes, 4.00 average.

Mass File Renamer: Changing Cases(Upper/Lower)

Posted 09-13-2008 at 09: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.
...
Senior Member
Posted in Uncategorized
Views 3859 Comments 0 ghostdog74 is offline
Old

Mass File Renamer: By Pattern Substitution

Posted 09-13-2008 at 09: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
...
Senior Member
Posted in Uncategorized
Views 2891 Comments 0 ghostdog74 is offline
Old
Rating: 2 votes, 3.00 average.

Mass File Renamer: By Number Sequence

Posted 09-13-2008 at 09: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
...
Senior Member
Posted in Uncategorized
Views 3045 Comments 0 ghostdog74 is offline

  



All times are GMT -5. The time now is 11:03 AM.

Main Menu
Advertisement
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration