Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
tar -cf /Users/Files/myfile.tar /Users/Files/

I am basically trying to create a tar containing the contents of User/Files and create it in the folder of the contents.

I can only execute this process in one line, so I cannot cd before.

share|improve this question

1 Answer 1

tar -cf myfile.tar /Users/Files/ && mv myfile.tar /Users/Files/
One line right? :D

You are archiving a folder and writing in it at the same time. That's really wrong and thankfully it does not work.

Since you are using ssh to pass this command you have most likely use something like this:

ssh <user>@<host> -- tar -cf myfile.tar /Users/Files/ && mv myfile.tar /Users/Files/

But in this example the && works between ssh and mv and not tar and mv. Use this instead:

ssh <user>@<host> -- "tar -cf myfile.tar /Users/Files/ && mv myfile.tar /Users/Files/"

By the way, The tar: Removing leading '/' from member names warning you may see is only a warning, not an error due to an absolute path.

share|improve this answer
    
The file doesn'¨t seem to be moved when executing a ls right aftr –  George Aug 5 '13 at 11:53
    
it works fine on my debian :/ what system are you under? You can replace && by ; but both are supposed to work. Why is you question tagged under ssh btw? –  Yoann Couble Aug 5 '13 at 12:23
    
since im using ssh :P –  George Aug 5 '13 at 14:26
    
Then tell it in your question body! I will edit my answer then –  Yoann Couble Aug 5 '13 at 14:34
    
I think I found the reason it didn't work, it was because of file permissions... –  George Aug 5 '13 at 22:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.