LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-06-2011, 02:55 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
mkisofs -o myiso.iso `cat filelist.lst` not working


Hello,

I have found today some problem with the following command:
Code:
mkisofs -o myiso.iso   `cat filelist.lst`
There are two issues. The first one is spaces, and the second one is that the files have a CR+LF in there for each files.

the filelist.lst have the files like ls -1 with separation by LF.

Cheers
 
Old 07-06-2011, 05:44 PM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
mkisofs accepts a single directory as an argument, not a list of files.

BTW, use $() instead of backticks. They can't be confused with single quotes, and they're easier to nest.
 
Old 07-06-2011, 06:32 PM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Thumbs up

Quote:
Originally Posted by MTK358 View Post
mkisofs accepts a single directory as an argument, not a list of files.

BTW, use $() instead of backticks. They can't be confused with single quotes, and they're easier to nest.

thanks. I tried but it failed too

Code:
mystring=""
while read each
do
    mystring="$mystring $each"
done<"filelist.lst"
mkisofs -o myiso.iso "$mystring"
 
Old 07-06-2011, 07:23 PM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by Xeratul View Post
thanks. I tried but it failed too

Code:
mystring=""
while read each
do
    mystring="$mystring $each"
done<"filelist.lst"
mkisofs -o myiso.iso "$mystring"
How is that different from supplying a list of files directly on the command line?

This should work, though:

Code:
tmpdir="/tmp/${RANDOM}-$(date +%s)"
mkdir tmpdir
while read file
do
    cp -R "$file" "$tmpdir"
done < filelist.lst
mkisofs -o myiso.iso "$tmpdir"
rm -r "$tmpdir"
 
Old 07-06-2011, 07:32 PM   #5
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by MTK358 View Post
How is that different from supplying a list of files directly on the command line?

This should work, though:

Code:
tmpdir="/tmp/${RANDOM}-$(date +%s)"
mkdir tmpdir
while read file
do
    cp -R "$file" "$tmpdir"
done < filelist.lst
mkisofs -o myiso.iso "$tmpdir"
rm -r "$tmpdir"
thank you! this method however copy the data in a temp folder. I avoid the issue regarding the input of "file1" "fil2" "file3" over mkisofs -o myiso.iso # here all the file names with "-" and separated with a space... I would rather avoid cp...
 
Old 07-06-2011, 07:49 PM   #6
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by Xeratul View Post
I avoid the issue regarding the input of "file1" "fil2" "file3" over mkisofs -o myiso.iso # here all the file names with "-" and separated with a space... I would rather avoid cp...
That sentence doesn't make any sense at all.

cp has no problem with filenames that have spaces, is that's what you're thinking. If you're worried that a filename begins with "-", then replace the cp line with this:

Code:
cp -R -- "$file" "$tmpdir"

Last edited by MTK358; 07-06-2011 at 07:51 PM.
 
  


Reply



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
Too big iso created by mkisofs for cdrecord Squall90 Linux - Software 12 07-17-2010 09:11 AM
how to use mkisofs to rebuild iso image austinium Linux - Newbie 3 03-11-2010 10:13 PM
[SOLVED] Cannot get $? (ret code) of cat file.lst | xargs rm - john lee Linux - Newbie 9 04-08-2009 12:52 PM
Using mkisofs to make a DVD ISO image mcfiddish Linux - Software 5 07-16-2007 03:32 AM
useing mkisofs to make iso from cd. sethgeekx86 Linux - Software 2 05-22-2004 12:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:43 AM.

Main Menu
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