mkdir & cp in one command?
Say I had a file called
/home/adirectory/text.txt and I wanted to copy it to a directory that does not yet exist, say /home/adirectory/newdirectory prior to executing the command I am looking for, the directory /home/adirectory does exist, but /home/adirectory/newdirectory does not exist In one command I want to create the new directory /home/adirectory/newdirectory AND copy the file /home/adirectory/text.txt to it I can do it thus $ mkdir newdirectory;cp test.txt ./newdirectory by chaining two commands, but I was wondering if it can be done using a single command. |
Try
Code:
mkdir newdirectory && cp test.txt newdirectory/test.txt |
All times are GMT -5. The time now is 05:30 PM. |