Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you provide output for the solution please. Thank you. Part B – projectSorte

ID: 3600104 • Letter: C

Question

Can you provide output for the solution please. Thank you.
Part B – projectSorter.pl Assume you have a directory filled with random files including some project files beginning with the string "proj" (e.g., proj1.c, projB.o, proj12.h) and no directories. Create a script which places each file into a corresponding project directory titled “assignmentXXX” where XXX is replaced with whatever follows the string “proj” in the file, not including the extension. Any other files not beginning with “proj” should be placed into a “misc” directory. The script should be invoked with the following format: projectSorter.pl directory Example data is located in /usr/local/courses/clark/cs3423/2017Fa/Proj6/ For part B, copy those into a directory named "DataB". Example: For a directory, DataB, containing the following files: input.txt proj1.c proj1.o proj12.c projPerl1.perl projPerl1.input projZ.c projZ.h trash.txt Executing: $ projectSorter DataB produces the following file structure in DataB: assignment1/ proj1.c proj1.o assignment12/ proj12.c assignmentPerl1/ projPerl1.perl projPerl1.input assignmentZ/ projectZ.c projectZ.h misc/ input.txt trash.txt Notes for partB: • The glob function can be useful in getting the contents of the specified directory. • You will probably need to use `expression` to invoke Linux commands to create directories and move files. What to turn in • A LastnameFirstname.zip file containing: o find.pl – Perl script for part A. o projectSorter.pl – Perl script for part B. Can you provide output for the solution please. Thank you.
Part B – projectSorter.pl Assume you have a directory filled with random files including some project files beginning with the string "proj" (e.g., proj1.c, projB.o, proj12.h) and no directories. Create a script which places each file into a corresponding project directory titled “assignmentXXX” where XXX is replaced with whatever follows the string “proj” in the file, not including the extension. Any other files not beginning with “proj” should be placed into a “misc” directory. The script should be invoked with the following format: projectSorter.pl directory Example data is located in /usr/local/courses/clark/cs3423/2017Fa/Proj6/ For part B, copy those into a directory named "DataB". Example: For a directory, DataB, containing the following files: input.txt proj1.c proj1.o proj12.c projPerl1.perl projPerl1.input projZ.c projZ.h trash.txt Executing: $ projectSorter DataB produces the following file structure in DataB: assignment1/ proj1.c proj1.o assignment12/ proj12.c assignmentPerl1/ projPerl1.perl projPerl1.input assignmentZ/ projectZ.c projectZ.h misc/ input.txt trash.txt Notes for partB: • The glob function can be useful in getting the contents of the specified directory. • You will probably need to use `expression` to invoke Linux commands to create directories and move files. What to turn in • A LastnameFirstname.zip file containing: o find.pl – Perl script for part A. o projectSorter.pl – Perl script for part B. Can you provide output for the solution please. Thank you.
Part B – projectSorter.pl Assume you have a directory filled with random files including some project files beginning with the string "proj" (e.g., proj1.c, projB.o, proj12.h) and no directories. Create a script which places each file into a corresponding project directory titled “assignmentXXX” where XXX is replaced with whatever follows the string “proj” in the file, not including the extension. Any other files not beginning with “proj” should be placed into a “misc” directory. The script should be invoked with the following format: projectSorter.pl directory Example data is located in /usr/local/courses/clark/cs3423/2017Fa/Proj6/ For part B, copy those into a directory named "DataB". Example: For a directory, DataB, containing the following files: input.txt proj1.c proj1.o proj12.c projPerl1.perl projPerl1.input projZ.c projZ.h trash.txt Executing: $ projectSorter DataB produces the following file structure in DataB: assignment1/ proj1.c proj1.o assignment12/ proj12.c assignmentPerl1/ projPerl1.perl projPerl1.input assignmentZ/ projectZ.c projectZ.h misc/ input.txt trash.txt Notes for partB: • The glob function can be useful in getting the contents of the specified directory. • You will probably need to use `expression` to invoke Linux commands to create directories and move files. What to turn in • A LastnameFirstname.zip file containing: o find.pl – Perl script for part A. o projectSorter.pl – Perl script for part B.

Explanation / Answer

Code for projectSorter.pl :

#Variable declaration done one for source variable reading from script parameter and other for misc folder

#Now by using grep condition get thet both file names list (one to misc other depending on file name)  

my @files_Name_proj = grep ( -f ,<proj*>) read_dir $source_dir;

my @files_Name_Not_proj = grep ( -f ,<-v proj*>) read_dir $source_dir ;

#Move all files to misc folder for files not starting with proj.

foreach my $t (@files_Name_Not_proj)

#Create new directory and move files starting with proj according to the filename projXXX

foreach my $t (@files_Name_proj)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote