SLUG Mailing List Archives
Re: [SLUG] spaces in filenames - bash scripting problem
- To: david@xxxxxxxxxxxxx
- Subject: Re: [SLUG] spaces in filenames - bash scripting problem
- From: Howard Lowndes <lannet@xxxxxxxxxxxxx>
- Date: Sat, 20 May 2006 15:12:26 +1000
- Cc: slug@xxxxxxxxxxx
- Organization: LANNet Computing Associates
- User-agent: Thunderbird 220.127.116.11 (X11/20060501)
The scrip works as long as there are no blanks.... unfortunately there
are lots of blanks in both directories and filenames. Can anyone tell me
what i should be doing?
# takes the first 3 chars of each directory and
# prepends it to the file names in that directory.
for x in $(ls)
I think this might work for you
y=$(echo "$x" | cut -c -3)
for z in $(ls "$x")
mv "$x"/"$z" "$x"/"$y""$z"
LANNet Computing Associates - Your Linux people <http://lannetlinux.com>
When you want a computer system that works, just choose Linux;
When you want a computer system that works, just, choose Microsoft.
Flatter government, not fatter government; abolish the Australian states.