[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] Filenames with spaces not handled properly
From: |
Terry Moore |
Subject: |
[Bug-tar] Filenames with spaces not handled properly |
Date: |
Tue, 25 Jan 2011 18:57:18 -0700 |
I routinely clean up old files after a time. Some of these files have spaces
in the file name. I have a Solaris 10 server. With tar, I used to have my ksh
script capture and change the IFS ksh variable. I save it to OIFS, set it to
just a newline character, and then do the tar using an include file containing
the list of files I want to put on the tape. When the tar is done, I put the
IFS back the way it was from OIFS.
This has worked quite well in the past, but does not work with gtar. Gtar
tells me it cannot stat the file and goes on. The files are there. It just
isn't handling the spaces correctly. Putting double quotes around the filenames
with spaces inside the include file doesn't help either.
Here is the relavent code in the script:
#!/usr/bin/ksh
# save the Internal Field Separator
OIFS=$IFS
# change it to just newline so spaces will be ignored
IFS="
"
echo "$IFS" |od -b
/usr/sfw/bin/gtar -C / -c -v -f /dev/rmt/foxc \
-T /home/prs/cleanup/mem_arc/tar2tape.list \
> /home/prs/cleanup/mem_arc/tarspace.log 2>&1
# put the IFS back to what it should be
IFS=$OIFS
The top of the tarspace.log file says:
$head -2 tarspace.log
0000000 012 012
0000002
Terry
- [Bug-tar] Filenames with spaces not handled properly,
Terry Moore <=