Question

In: Computer Science

Create a directory called CIS153 Create new files based on each line from mydata.txt. Each new...

  1. Create a directory called CIS153
  2. Create new files based on each line from mydata.txt. Each new file name starts with newFile. The files will be saved in CIS153 directory
  3. Delete all files that were created from step 2
  4. Delete the directory created from step 1
  5. Redirect the out from step 3 & 4 to a file called output.txt

Solutions

Expert Solution

IIf this is for windows 10, there is no verbose mode delete files. prompt is available. but chose to ignore as redirecting output to file. instead I wrote delete messages to output file. let me know if any changes required.

If you want it in Bash, let me know.

@echo off
REM Creating directory CIS153
mkdir CIS153
REM changing PWD to CIS153
cd CIS153
REM Read input file from user
set /p input= "Enter Input file: "
REM For each entry in input file
for /f "delims=" %%a in ('more %input%') do (
   REM Create an empty file starts with newFile
   type nul > newFile%%a
)
echo "Files Created"
echo "Delete Files?"
REM pausing before deleting file. this will give time
REM to look in to directory
pause
REM move out of CIS153
CD ..
for /f "delims=" %%a in ('dir CIS153 /b /a-d') do (
echo "Deleting " CIS153\%%a >> output.txt
REM Delete files in CIS153
del /Q CIS153\%%a >> output.txt
)
echo "Deleting " CIS153 >> output.txt
REM Delete directory
rmdir CIS153 >> output.txt
echo "Delete completed. Exit?"
pause


Related Solutions

Visual Basic Make a directory and copy some files from desktop to the created directory
Visual Basic Make a directory and copy some files from desktop to the created directory
List all files and directories in the current directory and store in a variable called malf....
List all files and directories in the current directory and store in a variable called malf. Count how many lines end with your firstname in the file /etc/conf Explain this command: mv pmu*.[ab]   cces/   Quick help in 5 min pleases with the UNIX program! I want only the final answer
Create a new folder called CSCI130_A3_yourname. Create all of the files indicated below within this folder....
Create a new folder called CSCI130_A3_yourname. Create all of the files indicated below within this folder. For this assignment you will be creating a total of 2 classes that meet the definitions below. This assignment will allow the user to enter in the coefficients for a polynomial function of degree 2. The user will then be asked to enter a number. The program will use that number as an argument to the function, and will print the corresponding function value....
In STS, create Java Project, called java_generics_yourNameLastname that; (Under source directory called, src, create a package...
In STS, create Java Project, called java_generics_yourNameLastname that; (Under source directory called, src, create a package csci3444.generics and put all code in it) Create a generic interface called “MyGenInterface” that takes 2 generic types K,V with below methods; public K getKey(); public V getValue(); Create a generic class called “MyGenClass” that implements “MyGenInterface” interface. has attributes “K key” and “V value” that can be inherited has a constructor that takes “K _key”, “V _value” inputs and initializes “key”, “value” attributes...
Please create (if not already in your linux home directory) files of any type. Once these...
Please create (if not already in your linux home directory) files of any type. Once these files are created, archive them, compress the archive and move these files to the thrash directory. This could be a script to be run from the shell or the script to be run from an executable file. Submit your code and clearly explain all steps of your script.
Using PyCharm, create a new Project lab8. Under lab8 create a new Directory exercise, then create...
Using PyCharm, create a new Project lab8. Under lab8 create a new Directory exercise, then create a Python file called nested.py, type the following: Test your code by putting the following at the bottom of the file: make_table_of_stars(2,3) (as shown in the code above). Run the file by right clicking in the code area of Pycharm, then choosing “Run nested”. Your output should be: *** *** (2 rows with 3 columns of stars). Reverse the 2 and 3. What happens?...
Linux Use touch to create a file in your working directory called PutFileHere this is a...
Linux Use touch to create a file in your working directory called PutFileHere this is a linux question i acidentally put javascript when i first submitted it
Part II: gdb (Debugging under Unix) create a new directory named by Inlab6Part2 enter the directory...
Part II: gdb (Debugging under Unix) create a new directory named by Inlab6Part2 enter the directory Inlab6Part2 create a file named by reverse_new.c with the following contents: /*reverse.c */ #include <stdio.h> void reverse(char *before, char *after); main() {       char str[100];    /*Buffer to hold reversed string */       reverse("cat", str); /*Reverse the string "cat" */       printf("reverse(\"cat\")=%s\n", str); /*Display result */       reverse("noon", str); /*Reverse the string "noon" */       printf("reverse(\"noon\")=%s\n", str); /*Display result */       } void reverse(char *before,...
You first needs to create a file called “myJS.js” in your project directory. Then, include the...
You first needs to create a file called “myJS.js” in your project directory. Then, include the AngularJS library and myJS.js in the header of the index.html page. Now, you need to define your angular application and a controller in this file such that the controller has the following variables with these initial values: name = "Alex Cool"; faculty= "Faculty of Busienss and IT"; university = {name:"University of Ontario Institute of Technology", url:"http://www.uoit.ca"}; contacts = {email:"[email protected]", phone:"xxx-xxx-xxxx"}; skills = [ {name:...
Ask the user for their name Create a file called "daily.dat" within the home directory Ask...
Ask the user for their name Create a file called "daily.dat" within the home directory Ask the user for a line of text that the system should save to the file Add to the file the line of text entered by the user Ask the user for a second line of text that the system should save to the file Append at the end of the file the line of text entered by the user Create a copy of the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT