|
From: Philipp Ghirardini on 15 Jun 2008 08:54 hi! I have the following problem: I want to pack all files in a special directory except some particular ones and delete them afterwards. The files shall be in the archive without subdirectories. I have the following tar command: tar --remove-files -C /net_tests/tests/dir_one -czf /net_tests/tests/dir_one/myzip.tar.gz . --exclude=file3 --exclude=myzip.tar.gz Actually it does exactly what I want but it returns 2 and not 0 because of the following reason: tar: .: Cannot rmdir: Invalid argument tar: Error exit delayed from previous errors I think the problem is that the command is packing the '.' and so it is trying to remove it what fails of course. I also creates a subdirectory '.' in the archive. Actually it doesn't matter because when unpacking the archive that has no effect. The problem is that I need the return value to check if the action was successful. Has anyone an idea? kind regards Philipp
From: J.O. Aho on 15 Jun 2008 09:16 Philipp Ghirardini wrote: > hi! > > I have the following problem: > > I want to pack all files in a special directory except some particular > ones and delete them afterwards. The files shall be in the archive > without subdirectories. > > I have the following tar command: > > tar --remove-files -C /net_tests/tests/dir_one -czf > /net_tests/tests/dir_one/myzip.tar.gz . --exclude=file3 > --exclude=myzip.tar.gz > > > Actually it does exactly what I want but it returns 2 and not 0 because > of the following reason: > > tar: .: Cannot rmdir: Invalid argument > tar: Error exit delayed from previous errors > > > I think the problem is that the command is packing the '.' and so it is > trying to remove it what fails of course. I think the tar is trying to delete dir_one, it could be better you switch to the directory in question, run the command (without the paths), think that will result in a 0. -- //Aho
From: Philipp Ghirardini on 15 Jun 2008 09:50 J.O. Aho wrote: > Philipp Ghirardini wrote: >> hi! >> >> I have the following problem: >> >> I want to pack all files in a special directory except some particular >> ones and delete them afterwards. The files shall be in the archive >> without subdirectories. >> >> I have the following tar command: >> >> tar --remove-files -C /net_tests/tests/dir_one -czf >> /net_tests/tests/dir_one/myzip.tar.gz . --exclude=file3 >> --exclude=myzip.tar.gz >> >> >> Actually it does exactly what I want but it returns 2 and not 0 >> because of the following reason: >> >> tar: .: Cannot rmdir: Invalid argument >> tar: Error exit delayed from previous errors >> >> >> I think the problem is that the command is packing the '.' and so it >> is trying to remove it what fails of course. > > I think the tar is trying to delete dir_one, it could be better you > switch to the directory in question, run the command (without the > paths), think that will result in a 0. > > Thanks for your fast reply. I think I'm doing that with the command -C. I jump into the directory '/net_tests/tests/dir_one' There I perform the packing on all files located '.'. I now tried to change the directory by hand and perform the following command: tar --remove-files -czf myzip.tar.gz . --exclude=file3 --exclude=myzip.tar.gz but got the same result. regards Philipp
From: jellybean stonerfish on 15 Jun 2008 11:41 On Sun, 15 Jun 2008 14:54:11 +0200, Philipp Ghirardini wrote: > I have the following tar command: > > tar --remove-files -C /net_tests/tests/dir_one -czf > /net_tests/tests/dir_one/myzip.tar.gz . --exclude=file3 > --exclude=myzip.tar.gz > I think the problem is that the command is packing the '.' and so it is > trying to remove it what fails of course. I also creates a subdirectory > '.' in the archive. Actually it doesn't matter because when unpacking > the archive that has no effect. > > Philipp Can you use a * to get all the files rather than a . to get the dir? stonerfish
From: Philipp Ghirardini on 15 Jun 2008 12:50 jellybean stonerfish wrote: > On Sun, 15 Jun 2008 14:54:11 +0200, Philipp Ghirardini wrote: > > >> I have the following tar command: >> >> tar --remove-files -C /net_tests/tests/dir_one -czf >> /net_tests/tests/dir_one/myzip.tar.gz . --exclude=file3 >> --exclude=myzip.tar.gz > >> I think the problem is that the command is packing the '.' and so it is >> trying to remove it what fails of course. I also creates a subdirectory >> '.' in the archive. Actually it doesn't matter because when unpacking >> the archive that has no effect. >> >> Philipp > > Can you use a * to get all the files rather than a . to get the dir? > > stonerfish > No, I tried that but than I got : tar: compile.sh: Cannot stat: No such file or directory tar: test_23s.cpp: Cannot stat: No such file or directory tar: test_23s_inp.cpp: Cannot stat: No such file or directory tar: test_9s.cpp: Cannot stat: No such file or directory tar: test_9s_inp.cpp: Cannot stat: No such file or directory tar: test_fast.cpp: Cannot stat: No such file or directory tar: test_fast_inp.cpp: Cannot stat: No such file or directory tar: Error exit delayed from previous errors Which are the files in the directory where i did the call and not the files of the directory I want to archive.
|
Next
|
Last
Pages: 1 2 Prev: EEEPC Astrologer Next: Why can't I specify multiple filenames with special symbols |