The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 03-11-2007
enuenu enuenu is offline
Registered User
 

Join Date: Mar 2007
Posts: 39
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.
Reply With Quote