Glam Prestige Journal

Bright entertainment trends with youth appeal.

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

5 Answers

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 running cat -A changeset.txt: normally there should just be a $ at the end of each line; if you see ^M$, you have a Windows file. The dos2unix command is often available to convert the line endings.

2

I had this same problem on my Mac (Darwin Kernel Version 10.8.0)

It turned out that two of the lines in my file.txt had an extra whitespace at the end of the line. Once I deleted the whitespace at the end of the lines, it worked fine. I confirmed this by re-adding a whitespace to the end of a line and it failed with an error stating:

Cannot stat: No such file or directory

So it appears that an extra whitespace anywhere or an extra blank line will cause a failure.

Also, FWIW, I was able to specify a file that contained either of the following:

./src/com/blarg/foo.java

or

src/com/blarg/foo.java

so either way was okay. it's just that pesky whitespace that is the problem.

on ubuntu 10.04, tar --files-from or -T options

when a the last line contains space, tar failed. If you add a blank line at the end , it's run.

Most likely tar would love to be noticed about the current path. So instead of

admin/memberinformation.php

the changeset.txt should read

./admin/memberinformation.php

or alternatively contain the full path.

2

I got it to work by running:

tar cvf ~/changeset.tar `cat ../changeset.txt`
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy