troubleshooting Question

Tar script from file list

Avatar of terencepires
terencepires asked on
Linux OS Dev
32 Comments1 Solution1942 ViewsLast Modified:
Hello,

i made a shell script to automatically tar files from a given filelist (.txt), the script is below.
My problem is that there is an issue with the tar command, which seems not to understand the name of the file i want to put in the archive.
For a given filename, i.e : bijou65_t.jpg, i get these errors...

bijou65_t.jpg

tar: Removing leading `/' from member names
tar: bijou65_t.jpg\r: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors

Can anyone tell me what's wrong ??


#!/bin/sh
i=0
workdir=`pwd`
basedir=/Users/terencepires/Documents/Skydog/Images/for_web/thumb
csvdir=/Users/terencepires/Documents/Skydog
 
cd $basedir
for file in $(cat $csvdir/ftpskydog.csv); do
curfile=`find . | grep  $file`
curfile=`echo "$file" | sed 's://:/:'`
echo $curfile
 
tar -cvfA /Users/terencepires/Documents/Skydog/skydogimg.tar $file > $csvdir/tar.log
done
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 32 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 32 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros