![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mkdir | mirusnet | UNIX for Advanced & Expert Users | 3 | 02-23-2008 05:00 AM |
| mkdir | big123456 | Shell Programming and Scripting | 2 | 07-22-2006 07:23 AM |
| calling mkdir from PHP | gmclean2006 | UNIX for Dummies Questions & Answers | 4 | 06-15-2006 06:23 PM |
| Can't mkdir in /home | leond | UNIX for Dummies Questions & Answers | 5 | 03-05-2003 07:04 AM |
| mkdir limitations | flignar | UNIX for Dummies Questions & Answers | 12 | 08-30-2002 11:30 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
cp & mkdir simultaneously
Can I create a new directory and copy files to it in a single command (not by linking 2 commands with a semi colon)? If so how? The only way I can see to do it is to first create the new directory using mkdir THEN copy files to it using the cp command.
|
| Forum Sponsor | ||
|
|
|
|||
|
Actually, I would not use a semicolon anyway ...
maybe you could use "mkdir dirname && cp /path/to/file* dirname/" instead It is still 2 commands, I don't know how to do it with one (I don't think it is possible) Why can't you use 2 commands ?? hope this can help |
|
|||
|
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. |