When I type:
tar -cvf ~/changeset.tar --files-from ~/changeset.txt
it responds with this output:
tar: admin/memberinformation.php : Cannot stat: No such file or directory
tar: business/clsPreferredAgencies.php : Cannot stat: No such file or directory
tar: business/clsPreferredAgencies_test.php : Cannot stat: No such file or directory
tar: business/clscustomer.php : Cannot stat: No such file or directory
tar: business/clsfeedback.php : Cannot stat: No such file or directory
tar: business/clsleads.php : Cannot stat: No such file or directory
tar: business/connection.php : Cannot stat: No such file or directory
tar: crons/daily_activity.php : Cannot stat: No such file or directory
tar: crons/not_closed_orders2.php : Cannot stat: No such file or directory
tar: crons/unaccepted_orders2.php : Cannot stat: No such file or directory
tar: js/jquery-1.4.2.js : Cannot stat: No such file or directory
tar: sql/alter-project.sql : Cannot stat: No such file or directory
tar: sql/buyerName.php : Cannot stat: No such file or directory
tar: sql/preferredAgencies.sql : Cannot stat: No such file or directory
tar: sql/underwriters_list.sql : Cannot stat: No such file or directory
tar: user/close_selectedporject.php : Cannot stat: No such file or directory
tar: user/feedback.php : Cannot stat: No such file or directory
tar: user/forum.php : Cannot stat: No such file or directory
tar: user/initiatelead.php : Cannot stat: No such file or directory
tar: user/leadprocess_detail.php : Cannot stat: No such file or directory
tar: user/mem_direc.php : Cannot stat: No such file or directory
tar: user/qws.php : Cannot stat: No such file or directory
tar: user/view_leaddetails.php : Cannot stat: No such file or directory
tar: user/viewfeedbackforusers.php : Cannot stat: No such file or directory
tar: user/viewfeedbacks.php : Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
lsiden@lsiden2:~/titan$ ls admin/memberinformation.php
admin/memberinformation.php
Here are the contents of ~/changeset.txt. In other words, a bunch of relative paths. As a sanity check:
$ ls admin/memberinformation.php
admin/memberinformation.php
Why can't tar find any of these files even though they are clearly reachable from the current directory with the relative paths given?
FYI:
$ tar --version
tar (GNU tar) 1.15.1
Best Answer
You have an extra space at the beginning of each line in
changeset.txt
.EDIT: Also, did you by any chance create
changeset.txt
on a Windows machine? If so, there may be an extra^M
character at the end of each line. Most unix programs will consider this character to be part of the line (here, part of the file name), whereas Windows considers the^M
part of the newline sequence. You can see whether this is the case by runningcat -A changeset.txt
: normally there should just be a$
at the end of each line; if you see^M$
, you have a Windows file. Thedos2unix
command is often available to convert the line endings.