Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
The problem statement, all variables and given/known data:
Hi there,
I wish to create a single .tar file of the current directory but have literally no idea on where to start
Relevant commands, code, scripts, algorithms:
No idea on where to start...
The attempts at a solution (include all code and scripts):
No attempts as not sure on where to start
Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Birmingham University , Birmingham, United Kingdom , Dr Fayzel , 211CDE
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Tar is one of the most difficult commands to master (IMHO) as it's command line syntax is very "old school". There are a fair few options to deal with, but to create a simple tar file of the current directory you only need to pay attention to the create "function letter," the file (archive) name option, and remember that dot (".") represents the current directory.
The examples in the man page, and these few hints should get you going.
If you have specific problems after you formulate your command, post those and someone will be happy to help.
I would suggest you make your own experience on the subject:
Create a directory add files in it (5-6 Mb. 10-20 files...) try to archive it using tar, then try to restore, then try to restore elsewhere (create another directory you can use for that...).
What did you manage? How?
There is a good reason why I ask you to create a test directory with a given size (perhaps you could use 10MB...). Depending of the OS you are on, classic issues where linked to backup software or tar usage e.g. inexistent tape devices...
After experimenting try to see if you can solve you request, if not explain why (what is not working the way you desire...) and we will try to assist you from there by giving perhaps new clues or correct your command line...
Thank you for your help guys, I have solved the issue but have a more interesting issue at hand.
The task is to create a c program that will check for a users input and then provide its length,the number of occurance of letters and the percentage of those letters.
E.g.
Input:
Hello Unix
Output:
Length of String: 9
Number of char h: 1
Number of char e: 1
Number of char l: 2
Number of char u: 1
Number of char n: 1
Number of char i: 1
Number of char x: 1
Percentage: of char h: 11.1%
etc
I have the following thus far:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <ctype.h>
int BackGroundProgram()
{
char ch;
do
{
char YourWord[100],b=0; // Array for the word that will be used
int i; // variable
int number;
int letters;
int length;
printf("Enter string to calculate the length:\n"); //Asking for User Input
scanf("%s",(YourWord)); // Scan for user input
for( i = 0; YourWord[ i ]; i++)
YourWord[ i ] = tolower(YourWord[ i ] ); //Make uppercase letters the same as lowercase ones
length = strlen(YourWord); // Calculate string length and store to variable length
printf("\n Length of the string = %d characters\n",length); //Display the length of the string
for(letters=33;letters<=126;letters++) //for loop to know the number of times a letter has occured
{
number=0;
b=0;
for(i=0;YourWord!=0;i++)
{
if(letters==YourWord)
{
number++;
b=1;
}
}
if(b==1)
printf("Number of times char %c occurred = %d time(s) and Percentage = %d%%"
,letters,number,number*100/length);
}
printf("\n Do you wish to try again continue (y/n) = \n"); //Check to see if the user wishes to go again.
scanf("%e");
}
while('y' ||'Y');
exit (0);
}
int main()
{
BackGroundProgram();
}
The code seems to finish after the first go and does not give the user another chance.
I thought the do while loop meant that it would keep running the loop until the user says no
Probably should have started this in a new thread as it's a bit different than your original question.
Anyway -- Your expression in the while needs to test the value of something. For instance, *x == 'y' . I didn't look very closely, but I also notice that your scanf() function doesn't provide a variable for the response which will likely cause unpredictable results if not a core dump.