Linux Shell Script - skeleton directory reproduction.

  • Posted
  • Proposals 4
  • Remote
  • #16235
  • Archived
Richard B.Martin W.Mihir D.Mountain F. have already sent a proposal.
  • 1

Description

Experience Level: Expert
We require a properly documented shell script for the following:

Specification (in 4 parts):

Part a:
Create a text file ('dirfile') showing the recursive directory structure of every directory below the current directory ('curdir').

Each directory will be on a new line in the text file and indented by one dot (hex 2E) for each level of directory it is below 'curdir', viz.
curdir
.1stlevelDirA
..2ndlevelDirAA
..2ndlevelDirAB
.1stlevelDirB
.1stlevelDirC
..2ndlevelDirCA
..3rdlevelDirCAA
.1stlevelDirD


Part b:
Repeat (a) above piping to 'curdirfiles' instead of 'curdir' with additional features:
- accept a single parameter ('filename')
- wherever a file exists in ANY of the directories of the form 'filename.<EXT>' where '<EXT>' may be any file extension then the file 'curdirfiles' will show the file in the listing. ie. ONLY the files begining with 'filename'

.1stlevelDirA
..2ndlevelDirAA
...filename.html <<<<<
...filename.php <<<<<
...filename2.php <<<<<
...filename_backup.php <<<<<
..2ndlevelDirAB
.1stlevelDirB
.1stlevelDirC
...filename.html <<<<<
...filename.cgi <<<<<
..2ndlevelDirCA
..3rdlevelDirCAA
.1stlevelDirD
..filename.txt <<<<<

Part c:
Similar to part (b) above except
Reproduce an identical directory structure as curdir called curdir2 on the same level as curdir with all file and directory perms and ownerships the same as they are in curdir.

Part d:
Same as part (c) above except duplicate the files as well like in part b. - again with all perms and ownerships preserved.


All code must be documented with a description of all variables - what they are for and where they are used.
Any regex used must be fully expained.

Only standard Linux shell commands may be used.

New Proposal

Create an account now and send a proposal now to get this job.

Sign up

Clarification Board

    There are no clarification messages.