Unix & Linux Asked on November 14, 2021
I ran:
tar -cjvf ~/Dict_$(date +%Y-%m_%d-%H_%M_%S).tar.bz2 ~/Dictionaries | xargs mv ~/Documents
but it leaves the resulting file in ~/
and does not move it.
How do I move the resulting file (after it was archived) to another folder?
Did you look at the output? Did it say something like
mv: target ‘some filename’ is not a directory?
In general, if cmd
outputs a
, b
and c
, and you run
cmd | xargs d e fthen
xargs
will rund e f a b cSo your command caused
xargs
to runmv ~/Documents file1 file2 file3 …That’s not how
mv
works.
Try
(your tar command) | xargs mv -t ~/Documents
Note: you should probably first verify that the version of mv
on your system supports the -t
option.
If you were on Linux, it would be pretty much guaranteed,
but I’m not sure about macOS.
Answered by G-Man Says 'Reinstate Monica' on November 14, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP