Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-24-2005, 01:48 AM   #1
fatbastard spice
LQ Newbie
Registered: Aug 2005
Distribution: Ubuntu
Posts: 2

Rep: Reputation: 0
bash script problem

I tried creating this script to fix some extensions on some mp3 files i'm getting from the linux dc++ client.



if [ -n "$1" ]
directory=$1 #If directory name given as a script argument
directory=$PWD #Otherwise current working directory

for file in $directory/*.dctmp
do mv \"$file\" \"${file%.m*p}$suffix\"

The script seems to work properly when i'm testing with the echo command just before the mv, but when i remove the echo i get this response - mv: when moving multiple files, last argument must be a directory

I'm imagining it's to do with the spaces in the file names, but i'm not sure. If i leave the echo command in and then copy the output and then paste it in the mv commands work fine.

Here's a sample of the command from the echo based version - mv "/home/mark/.dc++/Incomplete/04 Dormir Au Bord D'une Autoroute.mp3.dctmp" "/home/mark/.dc++/Incomplete/04 Dormir Au Bord D'une Autoroute.mp3"

Running Ubuntu Hoary.

Any ideas?
Old 08-24-2005, 02:06 AM   #2
Registered: Aug 2003
Location: Norway
Distribution: FC4
Posts: 83

Rep: Reputation: 20
Try to remove the \s from the mv command, you're not supposed to escape the quote marks.
Old 08-24-2005, 02:15 AM   #3
fatbastard spice
LQ Newbie
Registered: Aug 2005
Distribution: Ubuntu
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, worked a treat!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script problem GATTACA Programming 3 06-13-2005 09:59 AM
Problem with this bash script cantabile Programming 3 06-06-2005 05:31 PM
bash script problem cookie_ie Programming 3 03-23-2005 02:19 PM
bash script problem sorry99 Programming 2 09-20-2004 09:02 AM
Bash script problem kalleanka Programming 2 01-30-2004 11:59 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration