Help with directory management


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help with directory management
# 1  
Old 03-01-2004
Question Help with directory management

Hey guys.... I'm new to the unix environment. I'm trying to formulate a code with which I'm clueless. I want to write a code to save file(s) which were copied into a separate directory in my home directory with copied files having the same permissions both before and after they were copied.

If anyone can send send a copy of an example to me, I would be most appreciative. Thanks in advance to anyone who is reading this....

Looking forward to your responses.
# 2  
Old 03-01-2004
Not sure what you're trying to do... if you want to copy files from one directory to another and maintain their permissions, just use the cp command. But I'm hoping the question you're asking wasn't that simple....
# 3  
Old 03-02-2004
what I'm really doing is C Programming, but in UNIX as it has a low level language compiler, with directories the Borland Compiler doesn't have. I wanted to create some files, copy them, and save them to a directory within my home directory, so, I was looking for a syntax to undertake that particular task. Thanks for the input...
# 4  
Old 03-02-2004
You can use the stdio package to manipulate file. Do "man stdio" and then read the man page for each of the routines like fopen, fprintf, fclose, etc. And if borland doesn't have those available it is in violation of the c standard.

It doesn't make sense to copy a file that you are writing...just write the data twice.

Another approach is to use the system calls directly.. "man open", "man read" will get you started there.
# 5  
Old 03-02-2004
Lightbulb

The routines which you've listed, Borland already have those routines available. I'm aware that I can make the file twice, but, i wanted to get a copy of the syntax to undertake the task of creating, copying and saving the file.
Secondly, the the low-level header files which Borland doesn't suppport which I was referring to includes: "dirent.h" "sys/types.h" "fcntl.h"...

These headers aren't supported by the borland compiler, so I wanted a copy of a code to see how the file would be created, copied, saved and be accessed from a directory within a directory. In other words, am looking for a "c programming syntax" to undertake the task mentioned.
# 6  
Old 03-02-2004
Well you already know how to create a file called "bob". To copy "bob" to "jack", you would just open "bob" read the data and write it to a file called "jack".

The dirent.h supports routines called opendir, readdir, closedir, etc. The all have man pages and a command like "man opendir" will show you how to use them. But you don't need them here. They would be used to scan an entire directory. When you open "bob", the kernel scans the directory for you.

After you open "bob", you can use "stat()" to get the permissions on the file. And again stat has a man page.

Syntax-wise these are all just functions, there is nothing special about them.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

Individual Risk Management (Personal IT Security) and Browser Cache Management

Original post from this thread on browser caching. To add to this, it is an effective security measure to clear absolutely all cached data (cookies, web content, ....) when closing the browser - i.e. in case of a shutdown. It takes a bit of work to re-login to all the sites but websites will not... (7 Replies)
Discussion started by: bakunin
7 Replies

2. UNIX for Advanced & Expert Users

Password management

You know those lists of "the most common passwords"? I was looking at one of those because I actually want to use a really common password or two on occasion. The thing is I'm skeptical that these are legitimate lists. Most things these days require at least 8 chars with a numeral. But these lists... (1 Reply)
Discussion started by: jutnobs
1 Replies

3. IP Networking

IP Management

Hello all, I was wondering which way do you use to manage you IPs? For example in our case we have excel sheets and we export them in html first and import it to a server running apache, so to be visible from all. But i was wondering if there are any way (prefer a way running in web server)... (2 Replies)
Discussion started by: @dagio
2 Replies

4. HP-UX

Patch Management

HI all, As per the audit policy, patch has to be apply periodically, but in my scenerio, it has been applied lastly in the year 2010. Using HP UX 11.11, 11.21 and 11.31 I would like to know, how to identify the patches which are need to update, what will be the procedure to update, how to... (5 Replies)
Discussion started by: selvaforum
5 Replies

5. UNIX and Linux Applications

Password management / centralized password management

Hello all, I need help for build server call as Password management / centralized password management server. My situation and example: I have 600 server in my server room running on Linux then I need 1 server only can create login/password and then user can login to all 600 server no... (2 Replies)
Discussion started by: sheikh76
2 Replies

6. HP-UX

Software management HP/UX 9.00

Hello, all! I'm newbie in HP/UX and at my job I'm dealing with HP/UX 9.00. Due this OS is an old one, I couldn't find some info, concretely, about software management on it. Can you please help me? (5 Replies)
Discussion started by: Che_G
5 Replies

7. Shell Programming and Scripting

string management

I want to prompt for a full name, then select the surname from the full name. Then address the person as the surname entered in the fullname (1 Reply)
Discussion started by: orjnet
1 Replies

8. Programming

Need to know about Event Management

Hi I need to understand abt Event Management Library for example..A module will be responsible for Handling the event posted by the other modules...and creating a new process for handling the event posted by the other modules..also after completing the event clearing of the event... Need to... (3 Replies)
Discussion started by: nathgopi214
3 Replies

9. AIX

User Management

Can someone suggest me any means of having a controlled way to user access ... basically we have a varied environment of people(users) logging in to AIX boxes ... either via 1) telnet ... 2) application 3) databse (SQL's) what we need to do is formalise this .. can someone help me with this ... (2 Replies)
Discussion started by: rajesh_149
2 Replies
Login or Register to Ask a Question