Results 1 to 2 of 2
I am new to programming and wanted to know if I could get some assistance on this shell programming problems I wrote two script files: a rename file bash script ...
- 10-31-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 4
Simple file rename and deletion
I am new to programming and wanted to know if I could get some assistance on this shell programming problems
I wrote two script files: a rename file bash script file that suppose to check the input and output files and a script that deletes files that haven't been used on a directory for a long time. However, I ran into some complications in my search and compiling on the script. I have tried to get some help from other forums and of course, I'm getting the run around.
Here are my codes:
code 1
#!/bin/bash
files=$(ls -1 | grep .mp3)
for x in $files
do
mv $x band_song$x
done
.................................................. ....................
code 2
#!/bin/bash
for X in *.html
do
rm "$X";
done
- 11-01-2007 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
i recommend you readthis.
use shell expansion instead of grepping...Code:#!/bin/bash files=$(ls -1 | grep .mp3) for x in $files do mv $x band_song$x done ......................................................................
Code:for x in *mp3 ...
just do rm *htmlCode:#!/bin/bash for X in *.html do rm "$X"; done


Reply With Quote
