Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 13th August 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default my 1st sh script

This is still unfinished


  rm -f $1/*jpg
  rm -f $1/Thumbs.db
  rm -f $1/*.ini

  for fileName in $1/*
    newFileName=$(echo "$fileName" | tr ' ' _)

    if [ "$fileName" != "$newFileName" ]
        mv -f "$fileName" "$newFileName"

    if [ "`file -b "$newFileName"`" = "directory" ]
        RenameFile "$newFileName"
        chmod uog-x "$newFileName"


RenameFile `pwd`
$ cd /home/share/music

$ mkplaylist.sh
chmod: /home/share/music/mp3/151/Code_Of_Tha_Street_[2003]/*: No such file or directory
chmod: /home/share/music/mp3/213/The_Hard_Way_[2004]/*: No such file or directory
chmod: /home/share/music/mp3/2Pac/2Pacalypse_Now_[1991]/*: No such file or directory
chmod: /home/share/music/mp3/2Pac/All_Eyez_On_Me_[1996]/*: No such file or directory
The top level files aren't renamed, and x flag ain't removed from permissions.
And i don't seem to get it why.

This script is supposed to rename all subdirectories and files in given directory so that they don't have spaces, remove windows crap files, and x attribute (which i have because i copied files from NTFS/FAT whatever)

Later i will make it also build playlists for my mplayer (which i run in slave mode), but that's another story....

plz, help me, i'm just starting to learn sh, and this is my 1st script that has more than 4 lines
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab won't run script Petrocelli08 FreeBSD General 4 7th March 2009 04:19 AM
Backup script(s)? giddyupman General software and network 2 3rd January 2009 02:06 PM
Handy X11 script Gabe_G23 Guides 6 25th October 2008 05:08 PM
Automation Script ninjatux FreeBSD General 2 24th October 2008 04:16 PM
Shell Script. bsdnewbie999 Programming 21 15th July 2008 07:54 AM

All times are GMT. The time now is 09:10 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick