It's UWAweek 30 (2nd semester, week 1)

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying selected article
Showing 1 of 1168 articles.
Currently 1 other person reading this forum.


 UWA week 42 (2nd semester, week 12) ↓
SVG not supported

Login to reply

👍x1
helpful
6:11am Tue 17th Oct, Christopher M.

ANONYMOUS wrote:
> Would it ever be the case that our mysync program is run with two directories of the form below: > .... > In this example, I am not too sure what would happen as it is not really able to be done on the sample solution. Is it alright to assume that, due to this, it would not be assessed?
I'm unsure why (it's very notable that) this case has generated as much discussion/confusion as it has. Yes, it's a valid/reasonable case that could be assessed. Here is a shellscript of commands to build a set of test directories and files. It uses the tree command to provide a visual recursive listing of the directories before and after synchronisation:
#/bin/bash

rm -rf dir1
#
mkdir dir1
date > dir1/file1
cal  > dir1/file2
#
mkdir dir1/dir2
ls   > dir1/dir2/file3
#
echo "before syncing:"
tree dir1
tree dir1/dir2
echo "____________________________"
#
./mysync dir1 dir1/dir2
echo "after syncing:"
tree dir1
tree dir1/dir2
#
rm -rf dir1

and its output when executed. A copy of each file below dir1 is made within dir1/dir2, and a copy of each file below dir1/dir2 is made within dir1.
before syncing:
dir1
|-- dir2
|   `-- file3
|-- file1
`-- file2

2 directories, 3 files
dir1/dir2
`-- file3

1 directory, 1 file
____________________________       
after syncing:
dir1
|-- dir2
|   |-- file1
|   |-- file2
|   `-- file3
|-- file1
|-- file2
`-- file3

2 directories, 6 files
dir1/dir2
|-- file1
|-- file2
`-- file3

1 directory, 3 files

and if we change the script to run ./mysync -r (recursively) we get:
before syncing:
dir1
|-- dir2
|   `-- file3
|-- file1
`-- file2

2 directories, 3 files
dir1/dir2
`-- file3

1 directory, 1 file
____________________________       
after syncing:
dir1
|-- dir2
|   |-- dir2
|   |   `-- file3
|   |-- file1
|   |-- file2
|   `-- file3
|-- file1
|-- file2
`-- file3

3 directories, 7 files
dir1/dir2
|-- dir2
|   `-- file3
|-- file1
|-- file2
`-- file3

2 directories, 4 files

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  7:24AM Jul 25 2024
Privacy policy